a = list(map(int, input().split())) print(a[0] - a[1] + a[2] * max(0, a[3] - a[4]))