#include<bits/stdc++.h>
using namespace std;
int main(){
long long a,c,p,q,r,x,temp=0;
cin>>a>>c>>p>>q>>r>>x;
if(a<c){
if(x>(c-a)*p){
x-=(c-a)*p;
temp+=c;
if(x>q){
x-=q;
temp+=x/r;
cout<<temp;
return 0;
}else{
cout<<temp;
return 0;
}
}else{
temp+=(x/(c-a))*p;
cout<<temp;
return 0;
}
}else if(a==c){
temp=c;
if(x>q){
x-=q;
temp+=x/r;
cout<<temp;
return 0;
}else{
cout<<temp;
return 0;
}
}else{
temp+=a;
temp+=x/r;
cout<<temp;
return 0;
}
return 0;
}