a,b,c,d,e = map(int,input().split()) print(max([(a+d*x)-(b+e*x) for x in range(c+1)]))