peterverebics/CodeNet_Python_118 huggingface dataset:
a,b,c,x,y=map(int, input().split( ))
#超過してよい
#x,y<=10000
ans=10**15

for i in range(0,max(x,y)+7):
    tmp = 2*i*c
    tmp+=max(0,(x-i)*a)
    tmp+=max(0,(y-i)*b)
    ans=min(ans, tmp)
print(ans)
a, b, c, x, y = map(int, input().split())

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

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

print(ans)
A,B,C_AB,X,Y = map(int, input().split())
if A+B >= 2*C_AB:
  print(2*C_AB*(min(X,Y)) + min(A,2*C_AB)*(X-min(X,Y)) + min(B,2*C_AB)*(Y-min(X,Y)))
else:
  print(A*X+ B*Y)
a, b, c, x, y = map(int, input().split())

ans = 0

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

print(ans)
def resolve():
    import math
    A, B, C, X, Y = map(int, input().split())
    ans = []
    for i in range(max(X, Y)*2+1):
        ans.append(C*i + A*(max(X-i/2, 0)) + B*(max(Y-i/2, 0)))
    print(math.floor(min(ans)))
resolve()
a, b, c, x, y = map(int, input().split())

cost = a*x+b*y

for i in range(max(x,y)):
  if min(x, y)-i-1 >=0:
    if cost > a*(x-i-1)+b*(y-i-1)+c*(i+1)*2:
      cost = a*(x-i-1)+b*(y-i-1)+c*(i+1)*2
  elif x-i-1 < 0:
    if cost > b*(y-i-1)+c*(i+1)*2:
      cost = b*(y-i-1)+c*(i+1)*2
  else:
    if cost > a*(x-i-1)+c*(i+1)*2:
      cost = a*(x-i-1)+c*(i+1)*2

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

A = a * x + b * y
if min(x,y) == x:
    B = c * x * 2 + (y-x) * b
    C = c * y * 2
else:
    B = c * y * 2 + (x-y) * a
    C = c * x * 2

print(min(A,B,C))
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

def main():
    a, b, c, x, y = MII()
    fee = min(a+b,c*2) * min(x,y)
    if x > y: fee += min(a,c*2)*(x-y)
    else: fee += min(b,c*2)*(y-x)
    print(fee)


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

ans = float('inf')
for i in range(0,2*max(x,y)+1,2):
    ab = i
    x_tmp = x - i//2
    y_tmp = y - i//2
    tmp = max(0,a*x_tmp) + max(0,b*y_tmp) + c*i
    if tmp < ans:
        ans = tmp
print (ans)
a, b, c, x, y = map(int, input().split())
print(min([a*x+b*y, a*(x-min([x,y]))+b*(y-min([x,y]))+2*c*min([x,y]),2*c*max([x, y])]))
a,b,c,x,y=map(int,input().split())
p = a*x + b*y
q = 2*c*max(x,y)
r = 2*c*x + b*(y-x)
s = 2*c*y + a*(x-y)
if x >=y:
        print(min(p,q,s))
else:
        print(min(p,q,r))
a,b,c,x,y=map(int,input().split())
ans1=a*x+b*y
ans2=2*c*max(x,y)
ans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))
print(min(ans1,ans2,ans3))
A,B,C,X,Y=map(int,input().split())
price=0
if A+B>C+C:
    minXY=min(X,Y)
    price+=minXY*C*2
    X-=minXY
    Y-=minXY
if A>C+C:
    price+=X*2*C
    X=0
else:
    price+=A*X
    X=0
if B>C+C:
    price+=Y*2*C
    Y=0
else:
    price+=B*Y
    Y=0
print(price)
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(x*2*c,y*2*c+(x-y)*a))
    else:
        print(min(y*2*c,x*2*c+(y-x)*b))
a,b,c,x,y=map(int,input().split())

ans=10**9
for i in range(2*max(x,y)+1):
  s=max(x-i//2,0)
  t=max(y-i//2,0)
  t_ans=s*a+t*b+i*c
  ans=min(ans,t_ans)

print(ans)
a,b,c,x,y = map(int,input().split())
cur = a*x+b*y
z = 0
while True:
  x,y,z = x-1,y-1,z+2
  if a*max(0,x)+b*max(0,y)+c*z <= cur:
    cur = a*max(0,x)+b*max(0,y)+c*z
  else:
    print(cur)
    exit()
a,b,c,x,y=map(int,input().split())
p=10**9
for i in range(max(x,y)+1):
  p=min(p,a*max(0,x-i)+b*max(0,y-i)+c*2*i)
print(p)
a, b, c, x, y, = map(int, input().split())
price = 10 ** 16
for i in range(10 ** 7):
    price = min(price, i * 2 * c + max(0, x - i) * a + max(0, y - i) * b)
print(price)
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    a, b, c, x, y = map(int, input().split())
    ans = 10 ** 10
    yen = 0
    if a + b > c * 2:
        yen += (c * 2 * min(x, y))
        x, y = x - min(x, y), y - min(x, y)

        if x > 0:
            yen += min(x * a, x * 2 * c)
        else:
            yen += min(y * b, y * 2 * c)

    else:
        yen += a * x + b * y
    print(yen)


resolve()
a, b, c, x, y = map(int, input().split())
price = float("inf")
max_iter = max(x, y)*2

for i in range(max_iter):
    a_num = max(x-i, 0)
    b_num = max(y-i, 0)
    price = min(price, a_num*a + b_num*b + 2*i*c)

print(price)
a,b,ab,x,y=map(int,input().split())
total=0
if a+b>2*ab:
    total+=min(x,y)*2*ab
    if x>y:
        x-=y
        if a>=2*ab:
            total+=2*ab*x
        else:
            total+=a*x
    elif x<y:
        y-=x
        if b>=2*ab:
            total+=2*ab*y
        else:
            total+=b*y
else:
    total+=a*x+b*y
print(total)
A, B, C, X, Y = map(int, input().split())
if A + B >= C * 2:
    price = min(X, Y) * C * 2
    tmp = min(X,Y)
    X = X - tmp
    Y = Y - tmp
    if A * X < C * X * 2:
        price += A * X
        X -= X
    if B * Y < C * Y * 2:
        price += B * Y
        Y -= Y
    price += C * 2 * max(X, Y)
    print(price)

else:
    print(A * X + B * Y)
A,B,C,X,Y = map(int,input().split())

ans = 10**9+7

for i in range(max(X,Y)+1):
    AB = i*2
    money = max(0,A*(X-i))+max(0,B*(Y-i))+C*AB
    ans = min(ans,money)
    
print(ans)
import math
import itertools
import numpy as np

def solve():
    a, b, c, x, y = map(int, input().split())
    case1 = a * x + b * y
    case2 = x * 2 * c + max(0, (y - x) * b)
    case3 = max(0, (x - y) * a) +  y * 2 * c
    case4 = max(x, y) * 2 * c
    print(min(case1, case2,case3,case4))
    return 0

if __name__ == "__main__":
    solve()
def solve():
    A, B, C, X, Y = map(int, input().split())
    
    ans = 5000 * 2 * 10 ** 5
    for i in range(max(X, Y) + 1):
        ans = min(ans, 2 * i * C + A * max(0, X - i) + B * max(0, Y - i))
    print(ans)


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

min_cost = float('inf')
for ab in range(max(X + 1, Y + 1)):
    cost = ab * C
    cost += A * max(0, X - ab)
    cost += B * max(0, Y - ab)
    if min_cost > cost:
        min_cost = cost
print(min_cost)
# -*- coding: utf-8 -*-

def main():

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

    if A + B <= 2 * C:
        ans = (A * X + B * Y)

    else:
        if X <= Y:
            ans = min(2 * C * X + B * (Y - X), 2 * C * Y)

        else:
            ans = min(2 * C * Y + A * (X - Y), 2 * C * X)
    

    print(ans)


if __name__ == "__main__":
    main()
A, B, C, X, Y = map(int, input().split())
price = A*X + B*Y
tmp = 0
for i in range(1, int(1 + 10e5)):
    tmp = 2*C*i + max(0, X-i)*A + max(0, Y-i)*B
    price = min(price, tmp)
print(price)
a,b,c,x,y = map(int,input().split())
if x < y:
    a, b, x, y = b, a, y, x
print(min(a*x+b*y,2*c*y + a*(x-y),2*c*x))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, C, X, Y = map(int, input().split())

    print(
        min(X * A + Y * B,
            2 * X * C + B * max(0, Y - X),
            2 * Y * C + A * max(0, X - Y)))


if __name__ == "__main__":
    main()
A,B,C,X,Y=map(int,input().split())
print(min(A*X+B*Y,C*2*Y+A*max(0,X-Y),C*2*X+B*max(0,Y-X)))
import sys

a, b, c, x, y = map(int, sys.stdin.readline().split())
if x > y:
    a, b = b, a
    x, y = y, x

def main():
    res = min(c * 2, a + b) * x + min(c * 2, b) * (y - x)
    print(res)

if __name__ ==  '__main__':
    main()
A,B,C,X,Y = list(map(int,input().split()))

tan = A*X + B*Y
hukuA = max(X,Y)*2*C
hukuB = min(X,Y)*2*C + (max(X,Y)-min(X,Y)) * (A if X>=Y else B)

print(min(tan,hukuA,hukuB))
a,b,c,x,y=map(int,input().split())
m=10**10
for i in range(10**6):
    m=min(m,2*c*i+a*max(0,x-i)+b*max(0,y-i))
print(m)
a,b,c,x,y=map(int,input().split())

loop=max(x*2,y*2)+1
ans=10**9

for i in range(loop):
  ab=i//2
  if x-ab>=0 and y-ab>=0:
    ans=min(ans,a*(x-ab)+b*(y-ab)+c*i)
  if x>=ab and y<ab:
    ans=min(ans,a*(x-ab)+c*i)
  if x<ab and y>=ab:
    ans=min(ans,b*(y-ab)+c*i)
  if x<ab and y<ab:
    ans=min(ans,c*i)
print(ans)
import math

A,B,C,X,Y=map(int,input().split())
limit=max(2*X,2*Y)

ans=float('inf')
#L=[]
for i in range(limit+1):
    temp=C*i+A*math.ceil(max(0,X-i/2))+B*math.ceil(max(0,Y-i/2))
    #L.append(temp)
    ans=min(ans,temp)

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

if a+b <= c*2:
    print(a*x +b*y)
else:
    if x>y:
        i=a
    elif x<y:
        i=b
    else:
        i=0
    
    p=min(x,y)*c*2 + abs(x-y)*i
    q=max(x,y)*c*2
    
    if p >= q:
        print(q)
    else:
        print(p)
#!/usr/bin/python3
#coding: utf-8

A, B, C, X, Y = (int(x) for x in input().split())

ret = 0
if A + B > C * 2:
    m = min(X, Y)
    X -= m
    Y -= m
    ret += m * C * 2

if X > 0:
    if A > C * 2:
        ret += X * C * 2
    else:
        ret += X * A

if Y > 0:
    if B > C * 2:
        ret += Y * C * 2
    else:
        ret += Y * B

print(ret)
a,b,c,x,y=[int(i)  for i in input().split()]
ans=1000000000
for k in range(10**5+1):
	money=2*c*k + max(x-k,0)*a + max(y-k,0)*b
	if(ans>money):
		ans=money
print(ans)
a, b, c, x, y = map(int, input().split())

# i組みのabを買うことについて全探索
ans = float("inf")
for i in range(max(x, y)+1):
    price = i * 2 * c + max(x-i, 0) * a + max(y-i, 0) * b
    ans = min(ans, price)
print(ans)
a,b,c,x,y = map(int, input().split())
ab = min(a+b,2*c)
a = min(a,2*c)
b = min(b,2*c)
print((x-y)*a+y*ab if x>y else (y-x)*b+x*ab)
a,b,c,x,y=map(int,input().split())
if x<y:
  x,y=y,x
  a,b=b,a
print(min(a*x+b*y,2*c*y+a*(x-y),2*c*x))
A, B, C, X, Y = map(int, input().split())

min_price = A * X + B * Y

if A + B > 2 * C:
    while X > 0 and Y > 0:
        X = X - 1
        Y = Y - 1
        min_price -= A + B - 2 * C

if X > 0 and A > 2 * C:
    while X > 0:
        X = X - 1
        min_price -= A - 2 * C

if Y > 0 and B > 2 * C:
    while Y > 0:
        Y = Y - 1
        min_price -= B - 2 * C

print(min_price)
a,b,c,x,y=map(int,input().split())
ret=float('inf')
for i in range(max(x,y)+1):
  ret=min(ret,i*c*2+max((x-i),0)*a+max((y-i),0)*b)
print(ret)
a,b,c,x,y=map(int,input().split())
if (a+b)>2*c:
    if x>y:
        if a>2*c:
            print(y*2*c+(x-y)*c*2)
        else:
            print(y*2*c+(x-y)*a)

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

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

ans = 0
if c * 2 > a + b:
    ans += a * x + b * y
else:
    if x > y:
        ans += c * 2 * y
        if a > c * 2:
            ans += (x - y) * c * 2
        else:
            ans += (x - y) * a
    else:
        ans += c * 2 * x
        if b > c * 2:
            ans += (y - x) * c * 2
        else:
            ans += (y - x) * b
        
print(ans)
a, b, c, x, y = map(int, input().split())
pmin = 10**10
for i in range(max(x, y)+1): # 2i枚のABピザを買う
    bx = max(0, x - i)
    by = max(0, y - i)
    pay = a*bx + b*by + 2*c*i
    pmin = min(pmin, pay)


print(pmin)
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())

if 2 * c == min(2 * c, a, b):
    print(c * 2 * max(x, y))
elif 2 * c <= max(a, b) and a == max(a, b):
    print(c * 2 * x + b * max(y - x, 0))
elif 2 * c <= max(a, b) and b == max(a, b):
    print(c * 2 * y + a * max(x - y, 0))
elif 2 * c <= a + b and x <= y:
    print(c * 2 * x + b * (y - x))
elif 2 * c <= a + b and x > y:
    print(c * 2 * y + a * (x - y))
else:
    print(a * x + b * y)
from collections import Counter

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

if a+b >= ab*2:
    if x < y:
        less, more = x, y
        cost_l, cost_m = a, b
    else:
        less, more = y, x
        cost_l, cost_m = b, a
    
    cost = less*ab*2
    more -= less
    less = 0

    if cost_m < ab * 2:
        cost += more*cost_m
    else:
        cost += more*ab*2

    print(cost)
else:
    print(a*x+b*y)
A, B, C, X, Y = map(int, input().split())
min_num = min(X, Y)
max_num = min(X, Y)
min_price = min(A + B, C * 2)
max_price = min(A + B, C * 2)
answer = min_num * min_price
# print(answer)

if X >= Y:
    answer += (X - min_num) * min(A, C * 2)
else:
    answer += (Y - min_num) * min(B, C * 2)

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

if X>Y:
    A,B,X,Y = B,A,Y,X

if 2*C < B:
    print(C*2*Y)

elif 2*C < A + B:
    print(C*2*X+B*(Y-X))

else:
    print(A*X+B*Y)
a, b, c, x, y = [int(x) for x in input().split()]

if x <= y:
    ans = min(a + b, 2 * c) * x
    ans += min(b, 2 * c) * (y - x)
else:
    ans = min(a + b, 2 * c) * y
    ans += min(a, 2 * c) * (x - y)

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

if x > y:
    tmp = c*y*2+a*(x-y)
else:
    tmp = c*x*2+b*(y-x)

ans = min(a*x+b*y, c*max(x, y)*2, tmp)
print(ans)
A,B,C,X,Y=map(int,input().split())
ans=5000*(10**5)*2+1

for i in range(max(X,Y)+1):
  total=0
  total=2*C*i+A*max(X-i,0)+B*max(Y-i,0)
  if ans>=total:
    ans=total
print(ans)
a, b, c, x, y = map(int, input().split())

ans = float("inf")
for i in range(0, max(2*x, 2*y)+1, 2):
    na = 0 if x-i//2 < 0 else x-i//2
    nb = 0 if y-i//2 < 0 else y-i//2
    ans = min(ans, c*i + a*na + b*nb)

print(ans)
a, b, c, x, y = map(int,input().split())
 
if a+b <= c * 2:
    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)
a, b, c, x, y = map(int, input().split())

# ABを買わない、AorBを買わない、AandBを買わない
if x >= y:
    print(min(x*a + y*b, 2*y*c + (x - y)*a, 2*x*c))
else:
    print(min(x*a + y*b, 2*x*c + (y - x)*b, 2*y*c))
a,b,c,x,y = map(int,input().split())
ans = 0
if a+b <= c*2:
    ans = a*x+b*y
else:
    if x>y:
        ans = min(2*c*y+(x-y)*a, 2*c*x)
    else:
        ans = min(2*c*x+(y-x)*b, 2*c*y)
print(ans)
a,b,c,x,y=map(int,input().split())
minpr=10e+10
memo=None
if x>=y:
  for i in range(x+1):
    price= i*a+ 2*(x-i)*c+ max(0,y-(x-i))*b
    minpr=min(price,minpr)
  print(minpr)
else:
  
  for i in range(y+1):
    price= i*b+ 2*(y-i)*c+ max(0,x-(y-i))*a
    minpr=min(price,minpr)
  print(minpr)
A,B,C,X,Y = map(int,input().split())

AB_set = C * 2

ans = min(A*X + B*Y, AB_set*max(X,Y), AB_set*min(X,Y) + A*abs(X-min(X,Y)) + B*abs(Y-min(X,Y)))

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

res = A*X +B*Y

for i in range(0,max(X,Y)+1):
  cand = 2*i*C + max(0,X-i)*A + max(0,Y-i)*B
  res = min(res,cand)
print(res)
a, b, c, x, y = map(int,input().split())

min_xy = min(x, y) 
max_xy = max(x, y)

min_xy_cost = min(a + b, c * 2) * min_xy

if x >= y:
  rest = x - y
  rest_cost = rest * min(a, c * 2)
else:
  rest = y - x
  rest_cost = rest * min(b, c * 2)
  
total = min_xy_cost + rest_cost

print(total)
A, B, C, X, Y = list(map(int, input().split()))
max_AB = max(X, Y)
ans = float('inf')
for i in range(0, max_AB + 1):
    X_num = max(X - i, 0)
    Y_num = max(Y - i, 0)
    ans = min(X_num * A + Y_num * B + 2 * C * i, ans)
print(ans)
# -*- coding: utf-8 -*-
a,b,c,x,y = [int(i) for i in input().split()]

if x <= y:
    ans1 = min(c * x * 2 + b * (y - x), c * y * 2)
    #print('a')
else: #x > y
    ans1 = min(c * y * 2 + a * (x - y), c * x * 2)
    #print('b')
ans2 = a * x + b * y
print(min(ans1, ans2))
A,B,C,X,Y = map(int,input().split())
if A + B <= 2 * C:
    print(X*A+Y*B)
else:
    if X >= Y:
        if A >= 2*C:
            print(2*X*C)
        else:
            print((X-Y)*A + 2*Y*C)
    else:
        if B >= 2*C:
            print(2*Y*C)
        else:
            print((Y-X)*B + 2*X*C)
a, b, c, x, y = map(int, input().split())
if a+b <= 2*c:
    print(a*x + b*y)
else:
    if x > y:
        if a < 2*c:
            print(2*y*c + (x-y)*a)
        else:
            print(2*x*c)
    else:
        if b < 2*c:
            print(2*x*c + (y-x)*b)
        else:
            print(2*y*c)
A, B, C, X, Y = map(int,input().split())
 
if A + B < 2 * C:
    print(A * X + B * Y)
elif min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y  else B) > (max(X , Y) * 2 * C):
    print(max(X , Y) * 2 * C)
else:
    print(min(X, Y) * 2 * C + abs(X - Y)*( A if X > Y  else B) )
a, b, c, x, y = map(int, input().split())
ans = 10 ** 50
for i in range(10 ** 5 + 1):
    ans = min(ans, (2 * c * i + max(x - i, 0) * a + max(y - i, 0) * b))
print(ans)
l = list(map(int, input().split()))
A, B, C, X, Y = l[0], l[1], l[2], l[3], l[4]
s_1, s_2, s_3 = 0, 0, 0

s_1 = A*X + B*Y

maxv = max([X, Y])
s_2 = 2*C*max([X, Y])
if X >= Y:
    s_3 = 2*C*Y + A*(X-Y)
else:
    s_3 = 2*C*X + B*(Y-X)

print(min([s_1, s_2, s_3]))
a,b,c,x,y = map(int,input().split())
cx,cy = 0,0
ans = 0

a1 = a*x+b*y
if x<y:
    a2 = 2*c*x + b*(y-x)
else:
    a2 = 2*c*y + a*abs(y-x)
a3 = c*max(x,y)*2
print(min([a1,a2,a3]))
A,B,C,X,Y=map(int,input().split())
tmp0 = X*A + Y*B
tmp1 = max(X,Y)*2*C
if X>Y:
    tmp2 = Y*2*C + (X-Y)*A
else:
    tmp2 = X*2*C + (Y-X)*B
print(min(tmp0,tmp1,tmp2))
A,B,C,X,Y=map(int,input().split())
a=A*X+B*Y
b=max(X,Y)*C*2
p=B if X<Y else A
c=min(X,Y)*2*C+abs(X-Y)*p
print(min(a,b,c))
A,B,C,X,Y = map(int,input().split())
C*=2
ans = min(X*A+Y*B,C*max(X,Y))
ans = min(X*C+max(0,Y-X)*B,Y*C+max(0,X-Y)*A,ans)

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

import math
saishou = math.inf

temp = 0

for i in range (0, X+1):
	temp = A*i+C*2*(X-i)
	if X-i < Y:
		if 2*C <= B:
			temp+=2*C*(Y-(X-i))
		else:
			temp+=B*(Y-(X-i))
	if saishou > temp:
		saishou = temp
                      
print(saishou)
def main():
    A, B, C, X, Y = map(int, input().split())
    ans = 10**10
    max_c = max(X, Y) + 1
    for i in range(max_c):
        num_c = i * 2
        num_a = max(0, X - i)
        num_b = max(0, Y - i)
        price = num_a * A + num_b * B + num_c * C
        ans = min(price, ans)
    print(ans)

if __name__ == '__main__':
    main()
def main():
    a, b, c, x, y = map(int, input().split())
    xyK = min(x, y)
    k = min(a + b, c * 2) * xyK
    x -= xyK
    y -= xyK
    print(k + x * min(a, c * 2) + y * min(b, c * 2))


if __name__ == '__main__':
    main()
A, B, C, X, Y = map(int, input().split())
a = A * X + B * Y
b = C * max(X, Y) * 2
c = A * (X - Y) + 2 * C * Y
d = B * (Y - X) + 2 * C * X
e = max(c, d)
ans = min(a, b, e)
print(ans)
a,b,c,x,y = list(map(int, input().split()))

if a + b < 2*c :
    print(x*a + y*b)
else :
    if x >= y :
        if a >= 2*c:
            print(y*2*c + (x-y)*2*c)
        else :
            print(y*2*c + (x-y)*a)

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

if x < y:
    big_num = y
    small_num = x
    big_price = b
    #small_price = a
else:
    big_num = x
    small_num = y
    big_price = a
    #small_price = b
    
ans = 0
ans += min(a + b, 2 * c) * small_num
ans += min(big_price, 2 * c) * (big_num - small_num)

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

plan_a = c * (2*x) + max(0, y-x) * b
plan_b = c * (2*y) + max(0, x-y) * a
plan_c = a * x + b * y

print(min(plan_a, plan_b, plan_c))
def LI():return map(int,input().split())
def I(): return input().split()

a,b,c,x,y=LI()
lst=[]
ans=0
for i in range(10**5+1):
    lst.append(2*i*c+max(0,x-i)*a+max(0,y-i)*b)
print(min(lst))
a, b, c, x, y = map(int, input().split())
ans = 10**9
for i in range(0, 10**5+1):
    cost = 2*c*i + a*max(0, x-i) + b*max(0, y-i)
    ans = min(cost, ans)
print(ans)
a, b, c, x, y = map(int, input().split())

c *= 2
t = 0

if a+b > c:
  v = min([x,y])
  t = v * c
  x, y = x-v, y-v

  if x>0:
    if a<c:
      t = t + a*x
    else:
      t = t + c*x
  elif y>0:
    if b<c:
      t = t + b*y
    else:
      t = t + c*y
else:
  t = a*x + b*y

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

atob = x*a + y*b

maxab = (max(x,y) * 2) * c

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

price = a * x + b * y
for i in range(max(x,y)+1):
    new_price = c * 2 * i + max(a * (x - i),0) + max(b * (y - i),0)
    price = min(price,new_price)

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

ans = min(a*x+b*y, c*x*2+b*max(0, y-x), a*max(0, x-y)+c*y*2)
print(ans)
A,B,C,X,Y = map(int,input().split())

# あり得るのはすべてA,Bで買う．少ない方を満たすまで
import math
max_money = A*X + B*Y

# 次にAをすべて！ABで買ってみる
if X>Y:
    max_money = min(2*X*C,max_money)
else:
    max_money = min(max_money,2*X*C + (Y-X)*B)


# 次にBをすべて！ABで買ってみる
if Y>X:
    max_money = min(2*Y*C,max_money)
else:
    max_money = min(max_money,2*Y*C + (X-Y)*A)

print(max_money)
a,b,c,x,y=map(int, input().split())
z = 0#xy
l= []
l.append(a * x+b * y)
while x > 0 or y > 0:
    x -= 1
    y -= 1
    z += 2
    x1 = x
    if x1 < 0: x1 = 0
    y1 = y
    if y1 < 0: y1 = 0
    l.append(a * x1 + y1 * b + z * c)
print(min(l))
a,b,c,x,y=map(int,input().split())
ans=float('inf')
for i in range(10**5+1):
    tmp=2*i*c+a*max(x-i,0)+b*max(y-i,0)
    ans=min(tmp,ans)
print(ans)
#!/usr/bin/env python3
a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
for i in range(1, max(x, y) + 1):
    d = a * max(0, (x - i)) + b * max(0, (y - i)) + (c * 2) * i
    ans = min(ans, d)
print(ans)
import sys
a, b, c, x, y = map(int, input().split())
ans=sys.maxsize
for i in range(max(x,y)+1):
  temp=2*c*i
  if x-i>0:
    temp+=a*(x-i)
  if y-i>0:
    temp+=b*(y-i)
  ans=min(ans,temp)

print(ans)
a, b, c, x, y = map(int, input().split())
c = 2 * c
ans = 1001001001
for i in range(max(x, y) + 1):
    tmp = a * max(0, x - i) + b * max(0, y - i) + c * i
    ans = min(ans, tmp)
print(ans)
A, B, C, X, Y = map(int, input().split())

# ans = float('inf')

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

min_xy = min(X, Y)
max_xy = max(X, Y)
ans1 = 2 * C * min_xy + A * (X - min_xy) + B * (Y - min_xy)
ans2 = A * X + B * Y
ans3 = 2 * C * max_xy
print(min(ans1, ans2, ans3))
A, B, C, X, Y = map(int, input().split())
a1 = A * X + B * Y
a2 = B * (Y - X) + C * 2 * X
a3 = A * (X - Y) + C * 2 * Y
a4 = a3 if X > Y else a2
a5 = C * 2 * max(X, Y)
ans = min(a1, a4, a5)
print(ans)
#Order can be reduced by diving cases but full search on purpose
a, b, c, x, y = map(int, input().split())
num = float("inf")
for i in range(max(x, y) + 1):
    num = min(num, a * max(0, (x - i)) + b * max(0, (y - i)) + 2 * c * i)
print(num)
A, B, C, X, Y = list(map(int, input().split()))

ans =0

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

res = float('inf')
for i in range(max(2*X,2*Y)+1):
    tmp = 2*i*C + max(0,X-i)*A + max(0,Y-i)*B
    res = min(res, tmp)
print(res)
a, b, c, x, y = map(int, input().split())

p1 = a * x + b * y
# A>C
p = c * 2 * x

if x >= y:
  p = p

else:
  p = p + (y - x) * b
      
# B>C
p2 = c * 2 * y
if x >= y:
  p2 = p2 + (x - y) * a
else:
  p2 =p2
  
print(min(p, p1, p2))