#include #include #include #include #include #include #include int howManyGames(int first, int diff, int atleast, int budget) { int result = 0; while(1) { budget -= first; if(budget < 0) { return result; } result++; if(first - diff >= atleast) { first -= diff; } else { first = atleast; } } return result; } int main() { int p; int d; int m; int s; scanf("%i %i %i %i", &p, &d, &m, &s); int answer = howManyGames(p, d, m, s); printf("%d\n", answer); return 0; }