a, b, c, d, e = map(int, input().split()) print(a - b + c * max(0, d - e))