#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } signed main(){ int A,B,C,D,E;cin>>A>>B>>C>>D>>E; int res=0,x=0,y=0; for(int i=1;i<=E;i++){ x++,y++; if(x<=A and y<=C) res++; if(x==A+B) x=0; if(y==C+D) y=0; } cout<