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