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

ans=10**12

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

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

  ans=min(ans,temp)

print(ans)

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

ans=0

if 2*C<A+B:

  Z=min(X,Y)

  X-=Z

  Y-=Z

  ans+=2*C*Z

A=min(A,2*C)

B=min(B,2*C)

ans+=A*X

ans+=B*Y

print(ans)

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

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

-ans = 10**12 -for i in range(10**5 + 1): -    temp = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B -    ans = min(ans, temp) +ans = 0 +if 2 * C < A + B: +    Z = min(X, Y) +    X -= Z +    Y -= Z +    ans += 2 * C * Z +A = min(A, 2 * C) +B = min(B, 2 * C) +ans += A * X +ans += B * Y