#include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int p,d,m,s; cin>>p>>d>>m>>s; //int cost; int y=1; for(int i=s;i>=0;) { if(i==s) i=i-p; else { int x=(p-y*d); if(x<=m) x=m; i=i-x; y++; } } cout<