#include using namespace std; int howManyGames(int p, int d, int m, int s) { int i=1,cost=p,count=0; if(i==1 && s>=cost) { s=s-p; count++; i++; } while((cost-d)>m && s>=cost) { cost=cost-d; s=s-cost; count++; i++; } while(s>=cost) { cost=m; s=s-cost; count++; } return count; // Return the number of games you can buy } int main() { int p; int d; int m; int s; cin >> p >> d >> m >> s; int answer = howManyGames(p, d, m, s); cout << answer << endl; return 0; }