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

res = a * x + b * y

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

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

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

res = A*X + B*Y

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

    if i >= X:

        res = min(res-B+2*C,res)

    elif i >= Y:

        res = min(res-A+2*C,res)

    else:

        res = min(res-A-B+2*C,res)

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

A, B, C, X, Y = list(map(int, input().split()))
res = A * X + B * Y
for i in range(max(X, Y)):
    if i >= X:
        res = min(res - B + 2 * C, res)
    elif i >= Y:
        res = min(res - A + 2 * C, res)
    else:
        res = min(res - A - B + 2 * C, res)
print(res)

-a, b, c, x, y = list(map(int, input().split())) -res = a * x + b * y -for i in range(1, max(x, y) + 1): -    res = min(res, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i) +A, B, C, X, Y = list(map(int, input().split())) +res = A * X + B * Y +for i in range(max(X, Y)): +    if i >= X: +        res = min(res - B + 2 * C, res) +    elif i >= Y: +        res = min(res - A + 2 * C, res) +    else: +        res = min(res - A - B + 2 * C, res)