import math M1, S1, M2, S2, N = map(int, input().split()) T1 = M1 + S1 T2 = M2 + S2 def my_lcm(x, y): return (x * y) // math.gcd(x, y) LCD = my_lcm(T1, T2) dp = [0] * (LCD * 2) i = 0 while i <= LCD: for j in range(M1): dp[i] += 1 i += 1 for j in range(S1): i += 1 i = 0 while i <= LCD: for j in range(M2): dp[i] += 1 i += 1 for j in range(S2): i += 1 if LCD < N: cnt = dp[:LCD].count(2) mod = N % LCD ans = cnt * (N // LCD) + dp[:mod].count(2) else: ans = dp[:N].count(2) print(ans)