a,b,c,d,e = map(int, input().split()) import math from functools import reduce def lcm_base(x, y): return (x * y) // math.gcd(x, y) l = lcm_base(a+b, c+d) s = ('1'*a+'0'*b)*(l//(a+b)) t = ('1'*c+'0'*d)*(l//(c+d)) cnt = 0 for i in range(l): if s[i] == '1' and t[i] == '1': cnt += 1 q, r = divmod(e, l) ans = cnt*q for i in range(r): if s[i] == '1' and t[i] == '1': ans += 1 print(ans)