A, B, C, D, E = map(int, input().strip().split(' ')) ans = max([(A + i * D) - (B + i * E) for i in range(C+1)]) print(ans)