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

ans = 5000 * 10**5 * 4 + 1

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

    a = c * C

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

    a += A*x + B*y

    ans = min(ans, a)



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 = 5000 * 10**5 * 4 + 1
for c in range(0, max(X, Y) * 2 + 1, 2):
    a = c * C
    x, y = max(0, X - c // 2), max(0, Y - c // 2)
    a += A * x + B * y
    ans = min(ans, a)
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 = 5000 * 10**5 * 4 + 1 -for c in range(0, max(X, Y) * 2 + 1, 2): -    a = c * C -    x, y = max(0, X - c // 2), max(0, Y - c // 2) -    a += A * x + B * y -    ans = min(ans, a) +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)