import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
inf = 10 ** 16
md = 10 ** 9 + 7
# md = 998244353

from math import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

a, b, c, d, e = LI()
l = lcm(a + b, c + d)
cnt = [0] * l
for i in range(l):
    if i % (a + b) < a and i % (c + d) < c: cnt[i] = 1

p, r = divmod(e, l)
ans = sum(cnt) * p + sum(cnt[:r])
print(ans)