A,B,C,D,E = map(int,input().split()) ans = A-B tas = A+1-1 cal = B+1-1 for i in range(C+1): tas += D cal += E ans = max(ans,tas-cal) print(ans)