a,b,c,d,e = map(int,input().split())
ans = a-b
now = a-b
for i in range(c):
    now += d-e
    ans = max(ans,now)
print(ans)