#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=0; int cc=0; int count=0; while(s>0){ cc=p-i*d; if(cc>=m); else cc=m; if(s>=cc){ s-=cc; } else{ break; } i++; } return i; } 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; }