#include using namespace std; int howManyGames(int p, int d, int m, int s) { bool flag=false; int ans=0; while(s>0){ s-=p; if(!flag) p-=d; if(p<=m){ p=m; flag=true; } ans++; if(s<0) ans--; //ans++; } return ans; /* if((p-m )%d==0) n=(p-m)/d; else{ n=(p-m)/d; n=n+1; } int sum= (n*(2*p+(n-1)*(-d)))/2; if(sum>=s){ s-=sum; int newn=s/m; return newn+n; } else{ int count=0; while(s>0){ s-=p; 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; }