peterverebics/CodeNet_Python_118 huggingface dataset:
A,B,C,X,Y = map(int, input().split())

n = min(X,Y)

sum = 0

sum = min(n*2*C, A*n+B*n)

if X>Y:
    n = X-n
    sum = sum + n*A
elif X < Y:
    n = Y - n
    sum = sum + n*B

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

ans = 10**5
for i in range(10**5):
    tmp = 2*c*i + max((x-i), 0)*a + max((y-i), 0)*b
    ans = min(ans, tmp)
print(ans)
A, B, C, X, Y = map(int, input().split())
value = float('inf')
D = max(A,B)
for i in range(D+1):
  E = min((X-i)*A, 0)
  F = min((Y-i)*B, 0)
  valueX = 2*i*C+E+F
  if valueX < value:
    value  = valueX
print(str(value))
def resolve():
    a, b, c, x, y = map(int, input().split())

    ans = a*x + b*y

    for i in range(x):
        num = a*i
        a_diff = x - i
        for j in range(y):
            c_max = max(a_diff, y-j)
            num += b*j + (c*2*c_max)
            ans = min(num, ans)

    print(ans)

if __name__ == '__main__':
    resolve()
a,b,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)
if (a+b)//2>=ab:
    if min(a,b)>ab*2:
        ans+=max(x,y)*2*ab
    else:
        ans+=abcnt*2*ab
        if x>y:
            ans+=(x-abcnt)*a
        else:
            ans+=(y-abcnt)*b
else:
    ans+=x*a+y*b
print(ans)
def resolve():
    A, B, C, X, Y = list(map(int, input().split()))
    if min(A, B) > C:
        print(2 * max(X, Y) * C)
        return
    if A + B > 2 * C:
        if X >= Y:
            print(2 * Y * C + max(X-Y, 0) * A)
        else:
            print(2 * X * C + max(Y-X, 0) * B)

    else:
        print(A * X + B * Y)

    return

resolve()
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c:
  print(x * 2 * c + (y - x) * b)
elif b > 2 * c:
  print(y * 2 * c + (x - y) * a)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)
a, b, c, x, y = map(int, input().split())

ans = 5000*(10**5)
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if (x-i)*a > 0:
        tmp_ans += (x-i)*a
    if (y-i)*b > 0:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

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

total = a*x+b*y
if a/2 + b/2 > c:
    if a > c and b > c:
        total = max(x,y)*2*c
    elif a < c and x >y:
        total = y*2*c+ round(x-y)*a
    elif b < c and y >x:
        total = x*2*c+ round(y-x)*b


print(total)
A, B, C, X, Y = map(int, input().split())
minXorY = min(2*X,2*Y)

if X > Y :
    amari = A*(X-Y)
else:
    amari = B*(Y-X)

yen = min(A*X+B*Y, C*minXorY+amari)
print(yen)
A, B, C, X, Y = map(int, input().split())

if A+B<=C*2:
    print(X*A+Y*B)
elif A<=C*2 and B<=C*2:
    if X>=Y:
        print(Y*C*2+(X-Y)*A)
    else:
        print(X*C*2+(Y-X)*B)
elif A>=C*2:
    if X>=Y:
        print(C*2*X)
    else:
        print(C*2*X+(Y-X)*B)
else:
    if X>=Y:
        print((X-Y)*A+C*2*Y)
    else:
        print(C*2*Y)
a,b,ab,x,y=map(int, input().split())
ans = 10**10
yen=0
for i in range(10**5):
    yen = i*2*ab + max(0, x-i)*a + max(0,y-i)*b
    ans = min(ans,yen)
print(ans)
a, b, c, x, y = map(int, input().split())

ans = 5000*(10**5)
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if x > i:
        tmp_ans += (x-i)*a
    if y > i:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

print(ans)
a,b,c,x,y = map(int, input().split())
if (a+b <= c*2):
    print(a*x+b*y)
else:
    if (x>=y):
        print(min(y*c*2+(x-y)*a,x*c*2))
    else:
        print(min(y*c*2+(y-x)*b,y*c*2))
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,x,y = map(int,stdin.readline().rstrip().split())
mi = 10**10

mi = min(mi,max(x,y)*2*c)
mi = min(mi,a*x+b*y)
if x >= y:
    mi = min(mi,(x-y)*a+y*2*c)
else:
    mi = min(mi,(y-x)*a+x*2*c)

print(mi)
A, B, C, X, Y = map(int, input().split())
ret = 5000 * (10 ** 5)
for i in range(10 ** 5 + 1):
    ret = min(ret, A * max(0, X - i) + B * max(0, Y - i) + 2 * i * C)
print(ret)
import sys
input = sys.stdin.readline

A,B,C,X,Y = list(map(int,input().split()))
cost = A*X+B*Y
if X >= Y:
    maxXY = X
    maxAB = A
else:
    maxXY = Y
    maxAB = B
ans = cost
for xy in range(1,maxXY+1):
    nc =  2*C*xy +max(0,(X-xy))*A+max(0,(Y-xy))*B
    #print(nc,cost)
    if nc >= cost: 
        break
    else:
        ans = nc
print(ans)
a,b,c,x,y = map(int, input().split())
mix_price = min(a+b,c*2)
if a > 2 * c and b > 2 * c:
  print(2 * c * max(x,y))
elif a > 2 * c:
  print(x * 2 * c + (y - x) * b)
elif b > 2 * c:
  print(y * 2 * c + (x - y) * a)
elif a + b > 2 * c and x > y:
  print(y * mix_price + (x - y) * a)
elif a + b > 2 * c and x < y:
  print(x * mix_price + (y - x) * b)
else:
  print(x * a + y * b)
A, B, C, X, Y = map(int, input().split())
list = []

for i in range(100001):
    price = 2*C*i + A*max(0,X-i) + B*min(0,Y-i)
    list.append(price)

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


if x >= y:
    tmp1 = y*2*c + (x-y)*a
    tmp2 = c*x*2
    tmp3 = a*x + b*y
    print(min([tmp1, tmp2, tmp3]))
else:
    tmp1 = x * 2 * c + (y-x) * a
    tmp2 = c * y * 2
    tmp3 = a * x + b * y
    print(min([tmp1, tmp2, tmp3]))
def solve(a,b,c,x,y):
  l = []
  for i in range(10**5):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
a, b, c, x, y = map(int, input().split())
ans = 0
if c < a and c < b:
  ans += c * max(x, y)*2
elif (c - a < 0 and abs(a-c) < abs(b-c)) or (c - b < 0 and abs(a-c) > abs(b-c)):
  ans += a*x + b* y
else:
  s = max(x, y)
  t = min(x, y)
  ans += c*t*2 + min(a, b)*(s-t)
print(ans)
A,B,C,X,Y=map(int, input().split())
ans = 500000000
for i in range( max(X,Y)+1 ):
  ans = min(ans, C*i*2 + A*(max(0,(X-i)))+B*(max(0,(Y-i))))
print(ans)
A,B,C,X,Y = map(int,input().split())
if A<=C  and B<=C:
  print(A*X+B*Y)
  
elif C<=A and C<=B:
  if X<=Y:
    a = 2*C*X+(Y-X)*B
    b = 2*C*Y 
    print(min(a,b))
  else:
    a = 2*C*Y+(X-Y)*A
    b = 2*C*X
    print(min(a,b))
    
elif A<=C and B>C:
  print(A*X+min(B,2*C)*Y)
  
else:
  print(B*Y + min(A,2*C)*X)
a,b,c,x,y = map(int,input().split())
min = x if x<y else y
price=0
if a+b > 2*c:
    price = min*2*c
    print(price)
    if a < c*2 and y<x:
        price+=a*(x-y)
    elif b<c*2 and x<y:
        price+=b*(y-x)
    else:
        diff = y-x if x<y else x-y
        price+=2*c*(diff)
else:
    price = a*x+b*y
print(price)
a,b,c,x,y = map(int,input().split())
ans = 0
if a+b<c*2:
    ans = a*x+b*y
elif a+b>c:
    ans = c*2*max(x,y)
else:
    ans = abs(x-y)
    if x<y:ans*=b
    else:ans*=a
    ans += c*2*min(x,y)
print(ans)
a,b,c,x,y=map(int,input().split())

if a+b<=2*c:
    print(a*x+b*y)
else:
    if a>c and b>c:
        print(2*max(x,y)*c)
    elif a>c and c>b:
        print(2*min(x,y)*c+min(b,c)*(y-x))
    elif a<c and b>c:
        print(2*min(x,y)*c+min(a,c)*(x-y))
a,b,c,x,y = map(int,input().split())

n = max(x,y) * 2 * c
m = x * a + y * b
print(min(n,m))
pa, pb, pab, x, y = map(int, input().split())
li = []
if x-y>= 0:
    li.append(pa*x+pb*y)
    li.append(pa*(x-y)+pab*2*y)
    li.append(pab*2*x)
if y-x>= 0:
    li.append(pa*x+pb*y)
    li.append(pb*(y-x)+pab*2*y)
    li.append(pab*2*y)
li.sort()
print(li[0])
A, B, C, X, Y = map(int, input().split())

C *= 2
ans = 0

if A + B > C:
    ans += min(X, Y) * C
    n = abs(X - Y)
    ans += n * A if X > Y else n * B
else:
    ans += A*X + B*Y

print(ans)
a,b,c,x,y=map(int,input().split())
if a + b <= 2*c:
    print(a*x + b*y)
elif min(a,b) < 2*c:
    if x > y:
        print(c*y*2 + a*(x-y))
    else:
        print(c*x*2 + b*(y-x))
else:
    print(c*max(x,y)*2)
a,b,c,x,y=map(int,input().split())

if a+b<=2*c:
    print(a*x+b*y)
else:
    if a>c and b>c:
        print(2*max(x,y)*c)
    elif a>c and c>b:
        c=c*2
        print(min(x,y)*c+min(b,c)*(y-x))
    elif a<c and b>c:
        c=2*c
        print(min(x,y)*c+min(a,c)*(x-y))
a, b, c, x, y = map(int, input().split())
ans = 5000 * max(x, y)
for i in range(max(x, y) * 2 + 1):
  if x - i//2 < 0 and y - i//2 < 0:
    n = c * i 
  elif x - i//2 < 0:
    n = c * i + (y - i//2) * b
  elif y - i//2 < 0:
    n = c * i + (x - i//2) * a
  else:
    n = c * i + (x - i//2) * a + (y - i//2) * b
  ans = min(ans, n)
print(ans)
a, b, c, x, y = map(int, input().split())
max_value = max(a, b)
min_value = min(a, b)
boundary_value = 2 * c

if boundary_value <= min_value:
    print(boundary_value * max(x, y))
elif min_value < boundary_value <= (min_value + max_value):
    if (a == max_value and y <= x) or (b == max_value and x <= y):
        print(boundary_value * max(x, y))
    else:
        print(boundary_value * (max(x, y) - abs(x - y)) +
              min_value * abs(x - y))
elif (min_value + max_value) < boundary_value:
    print(a * x + b * y)
A,B,C,X,Y=map(int,input().split())
if A+B<=2*C:
  print(X*A+Y*B)
else:
  if X<=Y:
    print(2*X*C+(Y-X)*B)
  else:
    print((X-Y)*A+2*Y*C)
A, B, C, X, Y = map(int, input().split())

if X > Y:
    many = A
else:
    many = B
    

if min(A, B) > 2 * C:
    ans = C * 2 * max(X, Y)
elif (A + B) / 2 <= C:
    ans = A * X + B * Y
else:
    ans = min(X, Y) * 2 * C + (max(X, Y) - min(X, Y)) * many

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

A = a * x + b * y
B = c * min(x, y) * 2 + a * abs(x - y)
C = c * max(x, y) * 2

print(min(A, B, C))
A, B, C, X, Y = map(int, input().split())
value = float('inf')
D = max(A,B)
for i in range(D+1):
  valueX = 2*i*C+(X-i)*A+(Y-i)*B
  if valueX < value:
    value  = valueX
print(str(value))
a,b,c,x,y = map(int,input().split())

if 2*c >= a+b:
    print(a*x+b*y)
else:
    if 2*c <=a or 2*c <=b:
        print(2*c*(max(x,y)))
    else:
        if x>=y:
            print(2*c*y+a*(x-y))
        else:
            print(2*c*x+a*(y-x))
a, b, c, x, y = map(int, input().split())
ab = min(x, y)//2 * 2
ans1 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ans2 = x*a + y*b

ab = max(x, y)//2 * 2
ans3 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ab = -(-max(x, y)//2) * 2
ans4 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ab = -(-min(x, y)//2) * 2
ans5 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b
print(min(ans1, ans2, ans3, ans4, ans5))
a, b, c, x, y = map(int, input().split())
mini = 10000000000
if x < y: temp = x
else: temp = y
for i in range(0, temp * 2 + 1, 2):
    # print(x - i/2, y - i/2, i)
    price = a * (x - int(i/2)) + b * (y - int(i/2)) + c * i
    if price < mini:
        mini = price
print(mini)
a, b, c, x, y = [int(i) for i in input().split()]
ans = 10**18
for i in range(min(x, y)*2 + 1):
    ans = min(ans, c * i + (x - i//2) * a + (y - i//2) * b)
print(ans)
A,B,C,X,Y=map(int,input().split())
if 2*C <= A+B:
  price= 2*C
else:
  price = A+B
maxN = max(X,Y)
miniN = min(X,Y)
res = miniN * price
residue = maxN - miniN
if residue == 0:
  print(res)
elif X > Y:
  res+= min(residue*A, residue*2*C)
  print(res)
elif Y < X:
  res +=  min(residue*B, residue*2*C)
  print(res)
A,B,C,X,Y=map(int,input().split())

P=X*A+B*Y
if X>Y:
    Q=C*2*Y+(X-Y)*A
    L=X*2*C
else:
    Q=C*2*Y+(Y-X)*B
    L=Y*2*C



print(min(P,Q,L))
A, B, C, X, Y = map(int, input().split())
res = float('Inf')
for Z in range(10**5):
    total = 2*Z*C + max(0, X - Z)*A + max(0, Y - Z)*B
    if res > total:
        res = total
print(res)
A, B, C, X, Y = map(int, input().split())
cost1 =  A+B; cost2 = C*2

if X == Y :
  print( X* min( cost1, cost2))
if X> Y:
  print( min( Y* min( cost1, cost2) + (X-Y)*A , X* min( cost1, cost2)))
else :
  print( min( X* min( cost1, cost2) + (Y-X)*A , Y* min( cost1, cost2)))
pa,pb,pab,a,b=list(map(int,input().split()))
S1=pa*a+pb*b
S2=2*pab*max(a,b)
if S1>S2:
  print(S2)
else:
  if pa+pb>pab*2:
    print(2*pab*min(a,b)+pa*(a-min(a,b))+pb*(b-min(a,b)))
  else:
    print(S1)
A,B,C,X,Y = map(int,input().split())

ans = 10**9+7
for i in range(1,(10**5)+1):
    tmp = i * 2 * C + max(0,X-i) * A + max(0,Y-i) * B
    ans = min(ans,tmp)

print(ans)
# -*- coding: utf-8 -*-
a, b, c, x, y = map(int, input().split())

total = a * x + b * y

if total > 2 * c * max(x, y):
  total = 2 * c * max(x, y)
elif a + b > 2 * c:
  diff_price_a_and_b = a + b - 2 * c
  total -= diff_price_a_and_b * min(x, y)
print(total)
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b > 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()
a,b,c,x,y = map(int, input().split())

costs = 0

while x>0 and y>0:
  if a+b>2*c:
    costs += 2*c
  else:
    costs = costs+a+b
  x -= 1
  y -= 1
  
if x>0:
  if a<=2*c:
    costs += x*a
  else:
    costs += x*2*c
def resolve():
    a, b, c, x, y = map(int, input().split())

    if a+b >= 2*c:
        com = min(x, y)
        ans = 2*c*com
        if 2*c < a or 2*c < b:
            ans += max(x-com, y-com)*2*c
        elif x > y:
            ans += a*(x-com)
        else:
            ans += b*(y-com)
    else:
        ans = a*x + b*y

    print(ans)

if __name__ == '__main__':
    resolve()
A, B, C, X, Y = map(int, input().split())
C = min(2*C, A+B)

ans = 0
ans += C*min(X, Y)
if X > Y:
  ans += min(C, A) * abs(X-Y)
else:
  ans + min(C, B) * abs(X-Y)
print(ans)
a,b,c,x,y=map(int,input().split())
cost=[]
cm=0
while cm<=max(x,y):
    am=x-cm//2    
    bm=y-cm//2
    if am>=0 and bm>=0: cost.append(am*a+bm*b+cm*c)
    elif am>=0 and bm<=0: cost.append(am*a+cm*c)
    elif am<=0 and bm>=0: cost.append(bm*b+cm*c)
    elif am<=0 and bm<=0: cost.append(cm*c)
    cm+=2
print(min(cost))
import sys
input = sys.stdin.readline

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

ans = 10**5 * 5000
for i in range(10**5+1):
    price = 2*C*i + A*max(0, X-i) + B*max(0, Y-i)
    ans = min(ans, price)
print(ans)
a,b,c,x,y = map(int, input().split())
ans = 700000000
for i in range(10001):
  amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b
  if ans > amount:
    ans = amount
print(ans)
import math

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

for c in range(max(X, Y) * 2 + 1):
    a = math.ceil(X - 0.5 * c) if X - 0.5 * c >= 0 else 0
    b = math.ceil(Y - 0.5 * c) if Y - 0.5 * c >= 0 else 0
    m = min(a * A + b * B + c * C, m)
    print(a, b, c)

print(m)
def main():
    a, b, c, x, y = map(int, input().split())
    
    t1 = a * x + b * y
    t2 = c * max(x, y) * 2
    if x >= y:
        t3 = c * y * 2 + a * (x - y)
    else:
        t3 = c * x * 2 + b *(y - 1)
        
    print(min(t1, t2, t3))
    
    
if __name__ == '__main__':
    main()
A,B,C,X,Y = map(int,input().split())

ans = 0

if 4 * C < (A + B):
  ans = C * max(X,Y) * 2
elif C < int((A + B) / 2):
  if X > Y:
    ans = Y * 2 * C + (X - Y) * A
  else:
    ans = X * 2 * C + (Y - X) * B
else:
  ans = A * X + B * Y
  
print(ans)
A, B, C, X, Y = map(int, input().split())

MIN = None
for i in range(100001):
    price = 2*C*i + A*max(0,X-i) + B*min(0,Y-i)
    if MIN is None:
        MIN = price
    MIN = min(MIN, price)

print(MIN)
#095_C
a,b,c,x,y=map(int,input().split())
ans=10**10

for ab in range(0,max(a,b)+1,2):
    tmp=max(0,x-ab//2)*a+max(0,y-ab//2)*b+ab*c
    ans=min(ans,tmp)

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

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

if A+B < 2*C:
    print(A*X+B*Y)
else:    #ABピザを二枚ずつ増やしていく
    ans = float('inf')
    for i in range(0,max(X,Y)*2+1,2):
        ans = min(ans, max((X-i//2), 0)+max(B*(Y-i//2),0) + C*i)
    print(ans)
pa, pb, pab, x, y = map(int, input().split())
li = []
if x-y>= 0:
    li.append(pa*x+pb*y)
    li.append(pa*(x-y)+pab*2*y)
    li.append(pa*(x-y+1)+pb+pab*2*(y-1))
    li.append(pab*2*x)
if y-x>= 0:
    li.append(pa*x+pb*y)
    li.append(pb*(y-x)+pab*2*y)
    li.append(pa+pb*(y-x+1)+pab*2*(y-1))
    li.append(pab*2*y)
li.sort()
print(li[0])
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,c,x,y = nm()

min_cost = 10**7
for i in range(10**6):
  cost=2*c*i+max(0,x-i)*a+max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)
import sys

a,b,c,x,y=map(int,input().split())
ans=0
ans1=0

if a+b<=c*2:
  while x>0 and y>0:
    ans+=a+b
    x-=1
    y-=1

elif a+b>=c*2:
  while x>0 and y>0:
    ans+=c*2
    x-=1
    y-=1
  while x>0 or y>0:
    ans1+=c*2
    x-=1
    y-=1

if x==0:
  while y>0:
    ans+=b
    y-=1

elif y==0:
  while x>0:
    ans+=a
    x-=1

if ans>ans1:
  print(ans1)
  sys.exit()
print(ans)
a, b, c, x, y = map(int, input().split())

count = a * x + b * y
for i in range(10 ** 5):
  num = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
  if(count > num):
    count = num

print(count)
def resolve():
    import sys
    input = sys.stdin.readline    
    a,b,c,x,y=map(int,input().split())
    z=min(x,y)
    ans=min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2)
    print(ans)

if __name__ == '__main__':
    resolve()
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B <= 2*C:
    print(A*X + B*Y)
  elif 2*C < A or 2*C < B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()
a, b, c, x, y = [int(i) for i in input().split()]
ans = 10**18
for i in range(max(x, y)*2 + 1):
    ans = min(ans, c * i + min(0,(x - i//2)) * a + min(0,(y - i//2)) * b)
print(ans)
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
    print(a*x+b*y)
else:
    if 2*c<=a or 2*c<=b:
        print(max(x,y)*2*c)
    else:
        if x>y:
            print(min(x,y)*2*c+abs(x-y)*a)
        else:
            print(min(x,y)*2*c+abs(x-y)*b)
A,B,C,X,Y = map(int,input().split())

if C > (A+B)/2:
    print(A*X+B*Y)
elif X > Y and C > A/2:
    print(C*Y*2+A*(X-Y))
elif X > Y and C < A/2:
    print(C*X*2)
elif X < Y and C > B/2:
    print(C*X*2+B*(Y-X))
elif X < Y and C < B/2:
    print(C*Y*2)
import numpy as np
def f(s):
    a, b, c, x, y = map(int, s.split())
    Min = np.inf
    for use_c in range(max(x, y) * 2 + 1):
        price = use_c * c + max(0, x - use_c // 2) * a + max(0, y - use_c // 2) * b
        if price < Min:
            Min = price
    print(Min)
a, b, c, x, y = map(int,input().split())

if (a+b)//2 <= c and x != 0 and y != 0:
    print(x*a + y*b)
    exit()
    
ans = 0

ans += min(x,y) * c * 2

if x >= y:
    ans += min((x-y)*a, (x-y)*2*c)
else:
    ans += min((y-x)*b, (y-x)*2*c)
    
print(ans)
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,c,x,y = nm()

min_cost = 10**7
for i in range(10**5+1):
  cost=2*i*c+max(0,x-i)*a+max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)
A, B, C, X, Y = map(int, input().split())
print(min(max(A,B)*min(X,Y)+min(A,B)*max(X,Y), ((max(X,Y)-min(X,Y))*A)+2*C*min(X,Y) if A <= B else (max(X,Y)-min(X,Y))*B+2*C*min(X,Y), 2*C*max(X,Y)))
a,b,c,x,y = map(int,input().split())
c = c*2
n = max(x,y)
ans = 10**25
for i in range(n+1):
    x1,y1 = i,i
    p = c*i
    if x > x1:
        if y > y1:
            p += a*(x-x1) + b*(y-y1)
        else:
            p += a*(x-x1)
    else:
        if y > y1:
            p += b*(y+y1)
    if ans > p:
        ans = p

print(ans)
a,b,c,x,y=map(int, input().split())
max_=max(x,y)
cost=0
for i in range(max_):
  cost_=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  cost=max(cost_,cost)
print(cost)
a, b, c, x, y = map(int, input().split())
if (a >= 2 * c and b >= 2 * c): print(max(x, y) * 2 * c)
elif (a + b <= 2 * c): print(a * x + b * y)
elif (x > y): print((x - 1) * 2 * c + a)
elif (y > x): print((y - 1) * 2 * c + b)
else: print(2 * c * x)
a,b,c,x,y = map(int, input().split())

if (a+b) > c*2:
  tmp = min(x,y)
  if x > y:
    print(c*2*tmp + a*(x-y))
  else:
    print(c*2*tmp + b*(y-x))
else:
  print(a*x + b* y)
a, b, c, x, y = map(int, input().split())
ab = min(x, y)//2 * 2
ans1 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ans2 = x*a + y*b

ab = max(x, y)//2 * 2
ans3 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b
print(min(ans1, ans2, ans3))
a, b, c, x, y = map(int, input().split())
ans = 0


if a + b  > c * 2:
    ans += (c * 2) * min(x,y)
    if x > y:
        ans += a * (x-y)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)
    elif y > x:
        ans += b * (y-x)
        if ans > (c * 2) * max(x,y):
            ans = (c * 2) * max(x,y)

elif a + b < c * 2:
    ans = (a * x) + (b * y)


print(ans)
A, B, C, X, Y = map(int, input().split())
cost1 =  A+B; cost2 = C*2

if X == Y :
  print( X* min( cost1, cost2))
if X> Y:
  print( min( Y* min( cost1, cost2) + (X-Y)*A , X* min( cost1, cost2)))
else :
  print( min( X* min( cost1, cost2) + (Y-X)*B , Y* min( cost1, cost2)))
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

a,b,c,x,y = nm()

min_cost = 10**6
for i in range(10**5+1):
  cost=2*c*i
  cost+=max(0,x-i)*a
  cost+=max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)
a,b,c,x,y = [int(i) for i in input().split()]
if a>2*c and b>2*c:
        m = max(x,y)*2*c
elif a>2*c:
        if x>=y:
            m = x*2*c
        else:
            m=x*2*c+(y-x)*b
elif b>2*c:
        if y>=x:
            m=y*2*c
        else:
            m=y*2*c +(x-y)*a
else:
    m = x*a + y*b
print(m)
a,b,c,x,y=map(int,input().split())
res1=a*x+b*y
if x>y:
    res2=c*2*y+a*(x-y)
else:
    res2=c*2*x+b*(y-x)
print(min(res1,res2))
a,b,c,x,y = map(int,input().split())
z = 0
p = 0

if a + b < c * 2:
    p = a * x + b * y
else:
    if x > y:
        x -= y
        z = y * 2
        y = 0
        if a > c * 2:
            z += x * 2

    else:
        y -= x
        z = x * 2
        x = 0
        if b > c * 2:
            z += 0

print(x * a + y * b + z * c)
import itertools
a,b,c,x,y = map(int, input().split(" "))
ans = 10 ** 11

if min(a, b) > 2 * c:
  print(c * max(x, y) * 2)

else:
  for i in range(min(x, y) + 1):
    temp = a * (x - i) + b * (y - i) + c * (i * 2)
    if ans > temp:
      ans = temp
  print(ans)
a,b,c,x,y = map(int, input().split())
kei = 0
if c > a/2 + b/2:
    kei = a * x + b*y

elif c*2 <= a+ b and a >= c * 2 and b >= c * 2 :
    kei += c * (min(x,y)*2)
    if x > y:
        kei += c * ((x - y)*2)
    else:
        kei += c * ((y - x)*2)

elif c <= a/2 + b/2:
    kei += c * (min(x,y)*2)
    if x > y:
        kei += a * (x -y)
    else:
        kei += b *(y-x)


print(kei)
a,b,c,x,y=map(int,input().split())
ans=10**18
for i in range(0,min(x,y)+1):
  tmp=(x-i)*a+(y-i)*b+i*c
  ans=min(ans,tmp)
print(min(ans,tmp))
A,B,C,X,Y = map(int,input().split())
if A + B >= 2 * C:
    if A >= 2 * C and B >= 2 * C:
        print(max(X, Y) * 2 * C)
    elif A > B:
        print(2 * C * Y + A * (X - Y))
    else:
        print(2 * C * X + B * (Y - X))
else:
    print(X * A + Y * B)
a,b,c,x,y = map(int,input().split())
p = max(x,y)
q = min(x,y)
ans = 0
if a+b>=2*c:
    if p == x:
        ans += 2*c*q + min(a,2*c)*(p-q)
    else:
        ans += 2*c*q + min(b,2*c)*(p-q)
else:
    if p == x:
        ans += (a+b)*q + min(a,2*c)*(p-q)
    else:
        ans += (a+b)*q + min(b,2*c)*(p-q)
         
print(ans)
print(a,b,c,x,y)
A, B, C, X, Y = map(int, input().split())
faceAB = (A + B) / 2
if faceAB < C:
    print(X * A + Y * B)
elif 2 * C < A and 2 * C < B:
    print(2 * C * max(X, Y))
else:
    if X < Y:
        print(2 * C * min(X, Y) + ((Y - X) * B))
    else:
        print(2 * C * min(X, Y) + ((X - Y) * A))
a,b,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)

if min(a,b)>ab*2:
    ans+=max(x,y)*2*ab
    
elif (a+b)//2>=ab:
    
    ans+=abcnt*2*ab
    if x>y:
        ans+=(x-abcnt)*a
    else:
        ans+=(y-abcnt)*b

else:
    ans+=x*a+y*b
print(ans)
A,B,C,X,Y = map(int,input().split())
count = 0
if A >= C*2 or B >= C*2:
    print(max(X,Y)*2*C)

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

a = A*X+B*Y

if 2*C < X:
    b = max(X,Y)*C*2
else:
    b = min(X, Y) * C * 2
    if X > Y:
        b += A * (X-Y)
    elif X < Y:
        b += B * (Y-X)


print(min(a, b))