A, B, C, X, Y = list(map(int, input().split()))

ret = A * X + B * Y

x = 0

y = 0

c = 0

while (X + Y) * 2 > c :

    c += 2

    x += 1

    y += 1

    ret = min(ret, A * max(0, X - x) + B * max(0, Y - y) + c * C)

print(ret)

A, B, C, X, Y = list(map(int, input().split()))

ret = float('inf')

for i in range(10 ** 5 + 1):

    ret = min(ret, A * max(0, X - i) + B * max(0, Y - i) + 2 * i * C)

print(ret)
A, B, C, X, Y = list(map(int, input().split()))
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c:
    c += 2
    x += 1
    y += 1
    ret = min(ret, A * max(0, X - x) + B * max(0, Y - y) + c * C)
print(ret)

A, B, C, X, Y = list(map(int, input().split()))
ret = float("inf")
for i in range(10**5 + 1):
    ret = min(ret, A * max(0, X - i) + B * max(0, Y - i) + 2 * i * C)
print(ret)

-ret = A * X + B * Y -x = 0 -y = 0 -c = 0 -while (X + Y) * 2 > c: -    c += 2 -    x += 1 -    y += 1 -    ret = min(ret, A * max(0, X - x) + B * max(0, Y - y) + c * C) +ret = float("inf") +for i in range(10**5 + 1): +    ret = min(ret, A * max(0, X - i) + B * max(0, Y - i) + 2 * i * C)