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



max_iter = max(X, Y) * 2

ans = float("inf")

for i in range(max_iter):

    a = max(X - i, 0)

    b = max(Y - i, 0)

    price = 2*C * i + A * a + B * b

    ans = min(ans, price)



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



ans = float("inf")

for i in range(max(X, Y)+1):

    x = max(X - i, 0)

    y = max(Y - i, 0)

    cost = 2*C * i + A * x + B * y

    ans = min(ans, cost)



print(ans)
A, B, C, X, Y = list(map(int, input().split()))
max_iter = max(X, Y) * 2
ans = float("inf")
for i in range(max_iter):
    a = max(X - i, 0)
    b = max(Y - i, 0)
    price = 2 * C * i + A * a + B * b
    ans = min(ans, price)
print(ans)

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

-max_iter = max(X, Y) * 2 -for i in range(max_iter): -    a = max(X - i, 0) -    b = max(Y - i, 0) -    price = 2 * C * i + A * a + B * b -    ans = min(ans, price) +for i in range(max(X, Y) + 1): +    x = max(X - i, 0) +    y = max(Y - i, 0) +    cost = 2 * C * i + A * x + B * y +    ans = min(ans, cost)