from math import gcd A, B, C, D, E = map(int, input().split()) AB, CD = A + B, C + D lcm = AB * CD // gcd(AB, CD) cnt = 0 for i in range(lcm): if i % AB < A and i % CD < C: cnt += 1 ans = E // lcm * cnt E %= lcm for i in range(E): if i % AB < A and i % CD < C: ans += 1 print(ans)