A,B,C,D,E=map(int,input().split()) res=A-B for i in range(C): A+=D*i B+=E*i res=max(res,A-B) print(res)