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