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

c*=2

ans=10**9

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

    tmp = cc * c

    tmp += max(0, x-cc)*a

    tmp += max(0, y-cc)*b

    ans = min(ans, tmp)

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

ans = 10**18

for z in range(0, max(X, Y) * 2 + 1, 2):

    x, y = max(0, X - z // 2), max(0, Y - z // 2)

    tmp = A * x + B * y + C * z

    ans = min(ans, tmp)

print(ans)

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

A, B, C, X, Y = list(map(int, input().split()))
ans = 10**18
for z in range(0, max(X, Y) * 2 + 1, 2):
    x, y = max(0, X - z // 2), max(0, Y - z // 2)
    tmp = A * x + B * y + C * z
    ans = min(ans, tmp)
print(ans)

-a, b, c, x, y = list(map(int, input().split())) -c *= 2 -ans = 10**9 -for cc in range(max(x, y) + 1): -    tmp = cc * c -    tmp += max(0, x - cc) * a -    tmp += max(0, y - cc) * b +A, B, C, X, Y = list(map(int, input().split())) +ans = 10**18 +for z in range(0, max(X, Y) * 2 + 1, 2): +    x, y = max(0, X - z // 2), max(0, Y - z // 2) +    tmp = A * x + B * y + C * z