#include #include #include #include #include #include #include void howManyGames(int p, int d, int m, int s, int answer) { // Return the number of games you can buy s = s - p; answer++; if(p > m) p = p - d; if(p > s) return answer; else if(p == s) { answer++; return answer; } } 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, answer); printf("%d\n", answer); return 0; }