#include using namespace std; #define all(x) (x).begin(),(x).end() #define pb push_back #define F first #define S second typedef vector vi; typedef long long ll; typedef pair ii; templatevoid smin(T &a,U b) { if(a > b) a = b; } templatevoid smax(T &a,U b) { if(a < b) a = b; } const ll mod=1000000007; const int N = 2e5+10; const int M = 2e6; int main() { // freopen("input.txt","r",stdin); int p,d,m,s; cin>>p>>d>>m>>s; int cnt=0,cur = p; for(cnt = 0;;++cnt) { if(s >= cur) { s-=cur; cur = max(m,cur-d); } else break; } cout<