#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair iint; typedef pair llll; #define ALL(x) (x).begin(),(x).end() const ll zero = 0; const ll one = 1; const ll INF = 9223372036854775807; //10^18 const int inINF = 2147483647; //10^9 const ll MOD = 1000000007; //10^9+7 const ll MOD2 = 998244353; void Yes() {printf("Yes\n");} void No() {printf("No\n");} void YES() {printf("YES\n");} void NO() {printf("NO\n");} int main(){ int a, b, c, d, e, p; cin >> a >> b >> c >> d >> e; p = (a+b) * (c+d); vector f(p,false); int x, y; x = a+b; y = c+d; for (int i = 0; i < p; i++) { if(i%x < a && i%y < c){ f[i] = true; } } int cnt = 0; for (int i = 0; i < p; i++) { if(f[i]) cnt++; } int ans = e/p * cnt; for (int i = 0; i < e%p; i++) { if(f[i]) ans++; } cout << ans << endl; }