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