#include using namespace std; int howManyGames(int p, int d, int m, int s) { int total = 0; int price = p; if(p <= s){ total++; s -= p; price -= d; } while(s >= price){ if(price >= m){ total++; s -= price; price -=d; } else{ price = m; if(s >= m){ total++; s -= price; } } } return total; } 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; }