using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static int howManyGames(int p, int d, int m, int s) { int sum = 0; int sale = 0; if (s < p) { return 0; } while (s - Math.Max(p - sale * d, m) >= 0) { sum++; s = s - Math.Max(p - sale * d, m); sale++; Console.Error.WriteLine(s); } return sum; } static void Main(String[] args) { string[] tokens_p = Console.ReadLine().Split(' '); int p = Convert.ToInt32(tokens_p[0]); int d = Convert.ToInt32(tokens_p[1]); int m = Convert.ToInt32(tokens_p[2]); int s = Convert.ToInt32(tokens_p[3]); int answer = howManyGames(p, d, m, s); Console.WriteLine(answer); } }