#include using namespace std; int main() { int p; int d; int m; int s; cin >> p >> d >> m >> s; long x,total_items=0,price=p; x=(p-m)/d; if(s>((x+1)*p-(x*(x+1)*d)/2)){ total_items=(p-m)/d+1; s=s-((x+1)*p-(x*(x+1)*d)/2); total_items=total_items+s/m; cout<=price){ total_items++; s=s-price; price=price-d; } cout<