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

ans = A*X+B*Y

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

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

print(ans)

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

if A+B < 2*C:

  ans = A*X+B*Y

else:

  XY = min(X,Y)

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

print(ans)

A, B, C, X, Y = list(map(int, input().split()))
ans = A * X + B * Y
for i in range(max(X, Y) + 1):
    ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + C * i * 2)
print(ans)

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

-ans = A * X + B * Y -for i in range(max(X, Y) + 1): -    ans = min(ans, A * max(X - i, 0) + B * max(Y - i, 0) + C * i * 2) +if A + B < 2 * C: +    ans = A * X + B * Y +else: +    XY = min(X, Y) +    ans = min(A * (X - XY) + B * (Y - XY) + 2 * C * XY, 2 * C * max(X, Y))