from math import gcd a, b, c, d, e = map(int, input().split()) lcm_n = (a + b) * (c + d) //gcd(a + b, c + d) DP = [0 for _ in range(lcm_n + 1)] for i in range(lcm_n): if 0 <= i % (a + b) < a and 0 <= i % (c + d) < c: DP[i + 1] = 1 for i in range(lcm_n): DP[i + 1] += DP[i] q, r = divmod(e, lcm_n) print(q * DP[-1] + DP[r])