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

num = float("inf")

for i in range(max(x, y) + 1):

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

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

num = float("inf")

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

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

print(num)
a, b, c, x, y = list(map(int, input().split()))
num = float("inf")
for i in range(max(x, y) + 1):
    num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)
print(num)

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

-a, b, c, x, y = list(map(int, input().split())) +A, B, C, X, Y = list(map(int, input().split())) -for i in range(max(x, y) + 1): -    num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i) +for i in range(0, (10**5) * 2 + 1, 2): +    num = min(num, max(0, X - i // 2) * A + max(0, Y - i // 2) * B + C * i)