#include #include #include #include #include #include #include int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy int i = s,j = 0,k,l,temp = p; while(i >= temp) { i = i - temp; if((temp - d ) >= m ) { temp = temp - d; j++; } else { temp = m; j++; } } return j; } 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; }