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