from math import gcd a, b, c, d, e = map(int, input().split()) x = a+b y = c+d cycle = x*y//gcd(x, y) memo1 = [0]*cycle pos = 0 for i in range(cycle//x): for j in range(a): memo1[pos] = 1 pos += 1 for j in range(b): pos += 1 memo2 = [0]*cycle pos = 0 for i in range(cycle//y): for j in range(c): memo2[pos] = 1 pos += 1 for j in range(d): pos += 1 memo = [0]*cycle for i in range(cycle): if memo1[i] == memo2[i] and memo1[i] == 1: memo[i] = 1 cnt = sum(memo) q, r = divmod(e, cycle) res = q*cnt for i in range(r): if memo[i]: res += 1 print(res)