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