#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int howManyGames(int p, int d, int m, int s) { int c=0; while(s>p) { if(p>m) { s=s-p; p=p-d; c++; } else { s=s-p; c++; } } return(c); } 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; }