# https://atcoder.jp/contests/abc095/tasks/arc096



# 値段,枚数

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



ans = float("inf")

for i in range(10 ** 5 * 2):

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



print(ans)

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



ans = float('inf')

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

    price = i * 2 * c

    if x > i:

        price += a * (x - i)

    if y > i:

        price += b * (y - i)

    ans = min(ans, price)



print(ans)

# https://atcoder.jp/contests/abc095/tasks/arc096
# 値段,枚数
A, B, C, X, Y = list(map(int, input().split()))
ans = float("inf")
for i in range(10**5 * 2):
    ans = min(ans, max(X - i, 0) * A + max(Y - i, 0) * B + 2 * i * C)
print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = float("inf")
for i in range(10**5 + 1):
    price = i * 2 * c
    if x > i:
        price += a * (x - i)
    if y > i:
        price += b * (y - i)
    ans = min(ans, price)
print(ans)

-# https://atcoder.jp/contests/abc095/tasks/arc096 -# 値段,枚数 -A, B, C, X, Y = list(map(int, input().split())) +a, b, c, x, y = list(map(int, input().split())) -for i in range(10**5 * 2): -    ans = min(ans, max(X - i, 0) * A + max(Y - i, 0) * B + 2 * i * C) +for i in range(10**5 + 1): +    price = i * 2 * c +    if x > i: +        price += a * (x - i) +    if y > i: +        price += b * (y - i) +    ans = min(ans, price)