#include #include #include #include #include #define md #define ll long long #define inf (int) 1e9 #define eps 1e-8 #define N using namespace std; int main() { int x,y,w,n; while (scanf("%d%d%d%d",&x,&y,&w,&n)!=EOF) { ll t=0,now=0; int tot=1; while (totnow*(x+y)+x) { now++; t=now*(x+y)-w;} else tot++; } printf("%I64d\n",t); } return 0; }