#include using namespace std; #include using namespace atcoder; using mint = modint1000000007; //using mint = modint998244353; template bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; } template bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; } #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef pair P; ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll a, ll b){return a * b / gcd(a, b);} //Google出力用 void Case(int i,char a,int j){ printf("Case #%d: %c %d\n",i,a,j); } int main(){ ll a,b,c,d,e; cin>>a>>b>>c>>d>>e; ll x=lcm(a+b,c+d); ll moto=0; ll ans=0; ll cnt=0; ll r1=0,r2=0,r1_yasumi=0,r2_yasumi=0; bool hantei1=true; bool hantei2=true; while(x>cnt){ if(cnt==x)break; if(cnt%(a+b)=x){ ans+=moto*(e/x); e-=x*(e/x); //cout<cnt){ if(cnt==e)break; if(cnt%(a+b)