from math import gcd from numpy import floor A, B, C, D, E = map(int, input().split()) n = A + B m = C + D L = int(n*m/gcd(n, m)) y = int(floor(E/L)) z = E - y*L i = 0 j = 0 l = 0 if E < L: X = E + 1 else: X = L + 1 if z > 0: for i in range(1, z + 1): if 0 < i % n <= A and 0 < i % m <= C: j += 1 else: None else: None for k in range(i + 1, X): if 0 < k % n <= A and 0 < k % m <= C: l += 1 else: None print(j + y*(j+l))