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

val = float('inf')

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

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

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



ans = 0

ans += min(A + B, 2 * C) * min(X, Y)

if X > Y:

    ans += min(A, 2 * C) * (X - Y)

elif X < Y:

    ans += min(B, 2 * C) * (Y - X)

print(ans)

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

A, B, C, X, Y = list(map(int, input().split()))
ans = 0
ans += min(A + B, 2 * C) * min(X, Y)
if X > Y:
    ans += min(A, 2 * C) * (X - Y)
elif X < Y:
    ans += min(B, 2 * C) * (Y - X)
print(ans)

-a, b, c, x, y = list(map(int, input().split())) -val = float("inf") -for k in range(10**5 + 1): -    val = min(val, 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b) -print(val) +A, B, C, X, Y = list(map(int, input().split())) +ans = 0 +ans += min(A + B, 2 * C) * min(X, Y) +if X > Y: +    ans += min(A, 2 * C) * (X - Y) +elif X < Y: +    ans += min(B, 2 * C) * (Y - X) +print(ans)