mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline a, b, c, d, e = map(int, input().split()) L = (a + b) * (c + d) move = [0] * L for i in range(L): if i % (a+b) < a and i % (c+d) < c: move[i] = move[i-1] + 1 else: move[i] = move[i-1] print(move[-1] * ((e - 1) // L) + move[(e-1) % L]) if __name__ == '__main__': main()