import math

A, B, C, D, E = map(int, input().split())

T1 = A + B
T2 = C + D

def compute_lcm(a, b):
    return a * b // math.gcd(a, b)

lcm = compute_lcm(T1, T2)

# Compute the overlap in one full LCM cycle
S = 0
for t in range(lcm):
    r1 = t % T1
    r2 = t % T2
    if r1 < A and r2 < C:
        S += 1

q = E // lcm
remainder = E % lcm

# Compute the overlap in the remainder part
R = 0
for t in range(remainder):
    r1 = t % T1
    r2 = t % T2
    if r1 < A and r2 < C:
        R += 1

total = q * S + R
print(total)