#include #include #include #include #include #include #include long howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy int k=0,c=0; while(k<=s) {if(p<=m) { p=m; k=k+p; } else{ k=k+p; p=p-d; } c++; } return c-1; } int main() { int p; int d; int m; int s; scanf("%i %i %i %i", &p, &d, &m, &s); long answer = howManyGames(p, d, m, s); printf("%ld\n", answer); return 0; }