a, b, c, x, y = list(map(int, input().split()))

mi = 10**10

for i in range(10**6):

    cost = c*2*i + a*max((x-i), 0) + b*max((y-i), 0)

    if cost < mi:

        mi = cost



print(mi)
a, b, c, x, y = list(map(int, input().split()))

if x > y:

    cost = min(a*x + b*y, x*c*2, y*c*2 + (x-y)*a)

else:

    cost = min(a*x + b*y, y*c*2, x*c*2 + (y-x)*b)



print(cost)
a, b, c, x, y = list(map(int, input().split()))
mi = 10**10
for i in range(10**6):
    cost = c * 2 * i + a * max((x - i), 0) + b * max((y - i), 0)
    if cost < mi:
        mi = cost
print(mi)

a, b, c, x, y = list(map(int, input().split()))
if x > y:
    cost = min(a * x + b * y, x * c * 2, y * c * 2 + (x - y) * a)
else:
    cost = min(a * x + b * y, y * c * 2, x * c * 2 + (y - x) * b)
print(cost)

-mi = 10**10 -for i in range(10**6): -    cost = c * 2 * i + a * max((x - i), 0) + b * max((y - i), 0) -    if cost < mi: -        mi = cost -print(mi) +if x > y: +    cost = min(a * x + b * y, x * c * 2, y * c * 2 + (x - y) * a) +else: +    cost = min(a * x + b * y, y * c * 2, x * c * 2 + (y - x) * b) +print(cost)