import math def main(): a, b, c, d, e = map(int, input().split()) cycle = (a + b) * (c + d) // math.gcd(a + b, c + d) dp = [0] * (cycle + 1) for i in range(cycle): if 0 <= i % (a + b) < a and 0 <= i % (c + d) < c: dp[i + 1] = 1 q, r = divmod(e, cycle) ans = q * sum(dp[:]) + sum(dp[:r + 1]) print(ans) if __name__ == "__main__": main()