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



res = 0

res += min(a+b,2*c)*min(x,y)

if x >= y:

    res += min(2*c*(x-y),a*(x-y))

else:

    res += min(2*c*(y-x),b*(y-x))



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

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

if X >= Y:

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

else:

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

print(res)
a, b, c, x, y = list(map(int, input().split()))
res = 0
res += min(a + b, 2 * c) * min(x, y)
if x >= y:
    res += min(2 * c * (x - y), a * (x - y))
else:
    res += min(2 * c * (y - x), b * (y - x))
print(res)

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

-a, b, c, x, y = list(map(int, input().split())) -res = 0 -res += min(a + b, 2 * c) * min(x, y) -if x >= y: -    res += min(2 * c * (x - y), a * (x - y)) +A, B, C, X, Y = list(map(int, input().split())) +res = min(A + B, 2 * C) * min(X, Y) +if X >= Y: +    res += min(A, 2 * C) * (X - Y) -    res += min(2 * c * (y - x), b * (y - x)) +    res += min(B, 2 * C) * (Y - X)