from math import gcd A, B, C, D, E = map(int, input().split()) x = gcd(A + B, C + D) y = ([1] * A + [0] * B) * ((A+B)//x) z = ([1] * C + [0] * D) * ((C+D)//x) c = 0 for i in range(x): if y[i] == 1 and z[i] == 1: c += 1 result = E // x * C for i in range(E % x): if y[i] == 1 and z[i] == 1: result += 1 print(result)