import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) INF = float('inf') MOD = 10**9 + 7 def solve(): A,B,C,D,E = MI() import math def my_lcm(x, y): return (x * y) // math.gcd(x, y) Loop = my_lcm(A+B,C+D) Same = 0 for l in range(Loop): if(l%(A+B) <= A-1 and l%(C+D) <= C-1): Same+=1 Ans = Same*(E//Loop) E = E - (E//Loop) * Loop#残り部分 #print(Ans,E) for l in range(E): if(l%(A+B) <= A-1 and l%(C+D) <= C-1): Ans+=1 print(Ans) return solve()