A,B,C,D,E=map(int,input().split())

ANS=A-B
for i in range(C+1):
    ANS=max(ANS,A-B+i*D-i*E)
print(ANS)