#include using namespace std; int howManyGames(int p, int d, int m, int s) { // Return the number of games you can buy //p-d m int total = p; int numgames = 0; int prevprice = p; int i = 1; int prevtotal = 0; while(total<=s) { int amount; if(p - i*d < m) amount = m; else amount = p - i*d; prevtotal = total; total+=amount; //prevprice=amount; numgames++; i++; } return numgames; } 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; }