#include <bits/stdc++.h>
using namespace std;
long long a,c,p,q,r,x,u,s;
int main()
{
scanf("%lld%lld%lld%lld%lld%lld",&a,&c,&p,&q,&r,&x);
u=p*(c-a);
if (x<=u)
{
s=x/p+a;
printf("%lld\n",s);
}
else if (x>u)
{
u+=q;
if (x<=u) printf("%lld\n",c);
else
{
x-=u;
s=c+x/r;
printf("%lld\n",s);
}
}
return 0;
}