a,b,c,d,e=[int(eval(input())) for _ in range(5)]

if a<0:

    print((-a*c+d+b*e))

else:

    print(((b-a)*e))
a,b,c,d,e=[int(eval(input())) for _ in range(5)]

print((-a*c+d+b*e if a<0 else (b-a)*e))
a, b, c, d, e = [int(eval(input())) for _ in range(5)]
if a < 0:
    print((-a * c + d + b * e))
else:
    print(((b - a) * e))

a, b, c, d, e = [int(eval(input())) for _ in range(5)]
print((-a * c + d + b * e if a < 0 else (b - a) * e))

-if a < 0: -    print((-a * c + d + b * e)) -else: -    print(((b - a) * e)) +print((-a * c + d + b * e if a < 0 else (b - a) * e))