peterverebics/CodeNet_Python_118 huggingface dataset:
a, b, c, x, y = map(int, input().split())
if c <= (a/2) and c <= (b/2):
    print(c*max(x, y)*2)
elif c <= (a + b) / 2:
    if x <= y:
        print(c*x*2+b*(y-x))
    else:
        print(c*y*2+a*(x-y))
else:
    print(a*x+b*y)
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)
ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
ans4=A * X + C * 2 *Y
ans5 = 2 * C * X + B * Y
print(min(ans1,ans2,ans3,ans4,ans5))
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
  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=map(int,input().split())
ans=10**18
for i in range(0,min(x,y)+1):
  tmp=(x-i)*a+(y-i)*b+2*i*c
  ans=min(ans,tmp)
print(min(ans,tmp))
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<2*c and b>2*c:
    print(y*2*c + max(0,x-y)*a)
elif a>c and b<c:
    print(x*2*c + max(0,y-x)*b)
elif a+b>2*c:
    if x>y:
        print(y*2*c+(x-y)*a)
    else:
        print(x*2*c+(y-x)*b)
else:
    print(a*x+b*y)
[a,b,c,x,y] = [int(i) for i in input().split()]

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

ans = 0

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

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

ans = 0

if 4 * C < (A + B):
  ans = C * max(X,Y) * 2
elif 2 * C < A + B:
  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())
m = min(X,Y)
m2 = max(X,Y)
if (A+B)/2 > C and m > 1:#できるだけCを買う方がお得
	ans = C*2*m
	if X>Y:
		ans += A*(X-Y)
	else:
		ans += B*(Y-X)
	if ans > C*2*m2:
		print(C*2*m2)
	else:
		print(ans)

else:
	print(A*X+B*Y)
A,B,C,X,Y = list(map(int,input().split()))
if A+B <= 2*C:
    print(A*X+B*Y)
    exit()
if X == Y:
    print(2*C*X)
elif X > Y:
    tmp = 2*C*Y
    m = min(2*C*(X-Y),A*(X-Y))
    print(tmp+m)
else:
    tmp = 2*C*X
    m = min(2*C*(Y-X),A*(Y-X))
    print(tmp+m)
a, b, c, x, y = map(int, input().split())
dc = c * 2
if dc < a + b:
    if dc < a or dc < b:
        ans = dc * max(x, y)
    else:
        ans = dc * min(x, y)
        if x > y:
            ans += a * (x - y)
        elif x < y:
            ans += b * (y - x)
else:
    ans = a * x + b * y
print(ans)
# https://atcoder.jp/contests/abc095/tasks/arc096

# 値段,枚数
A, B, C, X, Y = map(int, input().split())

# C * 2 は　A + Bとなる
ans = max(X, Y) * 2 * C

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

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

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

ans1 = int(A*X + B*Y)
ans2 = int(C*X + (Y-X)*B)
ans3 = int(C*Y + (X-Y)*A)

print(min(ans1,ans2,ans3))
S = input().split(" ")

A = int(S[0])
B = int(S[1])
C = int(S[2])
X = int(S[3])
Y = int(S[4])



def calculate(a,b,c,x,y):
    s1 = a * x + b * y

    base = min([x,y])

    if base % 2 == 1:
        base = base - 1


    values = [s1]
    for i in range(base):
        index = (i + 1)
        tmp = s1 - (A + B) * index + 2 * C * index
        values.append(tmp)



    print(min(values))


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

#全部Cで買うとき
a = 2*C*min(X,Y) + 2*C*(max(X,Y)-min(X,Y))
print(a)

#片方を全部Cで買うとき
if X > Y:
    b = 2*C*Y + (X-Y)*A
elif Y > X:
    b = 2*C*X + (Y-X)*B
else:
    b = a
print(b)
    
#全部AとBで買うとき
c = A*X + B*Y
print(c)

print(min(a,b,c))
a,b,c,x,y=map(int,input().split())
ans=0
if a+b>=c*2:
    print(a*x+b*y)
    exit()
elif x>=y:
    ans+=c*y
    x-=y
    if a>=c*2:
        ans+=c*2*x
    else:
        ans+=a*x
elif y>x:
    ans+=c*y
    y-=x
    if b>=c*2:
        ans+=c*2*y
    else:
        ans+=b*x
print(ans)
# https://atcoder.jp/contests/abc095/tasks/arc096

# 値段,枚数
A, B, C, X, Y = map(int, input().split())

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

print(ans)
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 X > Y:
        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())
ans = 500000000
ans = min(ans, A*X+B*Y)
ans = min(ans, C*min(X,Y))
ans = min(ans, (A+B)*min(X,Y)+C*(abs(X-Y)))
print(ans)
piza = list(map(int,input().split()))
half = False
sum = 0
if(piza[0] >= piza[2] and piza[1] >= piza[2]):
	sum += piza[2] * max(piza[3],piza[4]) * 2
	print(sum)
	exit()
elif(piza[0]+piza[1]>piza[2]*2):
	half = True
if(half == True):
	sum += min(piza[3],piza[4])*piza[2]*2
	if(piza[3] > piza[4]):
		sum += (piza[3]-piza[4])*piza[0]
	else:
		sum += (piza[4]-piza[3])*piza[1]
else:
	sum += piza[0] * piza[3] + piza[1] * piza[4]
print(sum)
a, b, c, x, y = map(int, input().split())
ret = 0
if 2 * c <= a + b:
  m = min(x, y)
  ret += m * c
  x -= m
  y -= m
ret += min(2 * c, a) * x
ret += min(2 * c, b) * y
print(ret)
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())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - k/2)
  j = max(0, Y - k/2)
  ans = min(ans, A*i + B*j + C*k)
print(ans)
A, B, C, X, Y = map(int, input().split())
min = A * X + B * Y

for x in range(X+1):
  for y in range(Y+1):
    if x <= y:
      z = 2 * (X - x)
    else:
      z = 2 * (Y - y)
    Sum = A * x + B * y + C * z
    if Sum < min:
      min = Sum

print(Sum)
a,b,c,x,y=map(int,input().split())
if 2*c > a+b:
    if 2*c < min(a,b):
        print(c*max(x,y))
    else:
        if x>=y:
            print(2*c*y+a*x)
        else:
            print(2*c*x+b*y)
else:
    print(a*x+b*y)
a , b , c , x , y = map(int,input().split())
n = max(x,y)
kar = a*x + b*y
for i in range(1,n+1):
    if kar > a*(max(0,x-i)) + b*(max(0,y-i)) +c*i:
        kar = a*(max(0,x-i)) + b*(max(0,y-i)) +2*c*i
print(kar)
sum = 0
A,B,C,X,Y = map(int,input().split())
AB = C*2
ans = float("inf")

for i in range(10**5+1):
    sum = AB*i + A*min(0,X-i) + B*min(0,Y-i)
    if sum < ans:
        ans = sum

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

print(min(C*2*min(X, Y) + abs(X-Y)*min(A, B), C*2*max(X, Y), A*X+B*Y))
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max+1):
    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())
ha = c/2
cost = 10000000000000000
for i in range(x):
  for j in range(y):
    res = a*i + 2*ha*(x-i) + b*j + 2*ha*(y-j)
    if x - i != y - j:
      res += abs((x-i)-(y-j))*2*ha
    if res < cost:
      cost = res
print(int(cost))
a,b,c,x,y = map(int,input().split())
ans = 0
if x>=y:
    if 2*c <= a:
        print(2*c*x)
    else:
        if 2*c <= a+b:
            print(2*c*y + a*(x-y))
        else:
            print(a*x + b*y)
else:
    if 2*c <= b:
        print(2*c*y)
    else:
        if 2*c <= a+b:
            print(2*c*x + a*(y-x))
        else:
            print(a*x + b*y)
A,B,C,X,Y = [int(x) for x in input().split()]

ans = A*X+B*Y
for i in [0, 1, max(1,A-1), max(1,X)]:
    for j in [0, 1, max(1,B-1), max(1,Y)]:
        ab = max(X-i, Y-j)
        ans = min(ans, A*i + B*j + C*(2*ab))
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = 1e1000
for i in range(0, 2*min(X, Y)+1, 2):
  ans = min(ans, A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i)
print(ans)
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
sum = 0

res = A*X + B*Y
for i in range(0,min_):
    sum += C * 2
if(C<=0.5 * A and C <= 0.5 * B):
    sum += 2*C*(max_-min_)
elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**5)
for a in range(x+1):
    c=(x-a)*2
    b=math.ceil(y-c/2)
    if c<0 or b<0:
        continue
    if A*a+B*b+C*c<price:
        price=A*a+B*b+C*c
print(price)
#n = int(input())
a,b,c,x,y = map(int,input().split())
#a_L = list(map(int,input().split()))

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

print(price)
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(A*(X-Y)+2*C*Y)
    else:
      print(2*C*X)
  else:
    if B < 2 * C:
      print(B*(Y-X)+2*C*X)
    else:
      print(2*C*Y)
A,B,C,X,Y = map(int,input().split())

#全部Cで買うとき
a = 2*C*min(X,Y) + 2*C*(max(X,Y)-min(X,Y))

#片方を全部Cで買うとき
if X > Y:
    b = 2*C*Y + (X-Y)*A
elif Y > X:
    b = 2*C*X + (Y-X)*A
else:
    b = a

#全部AとBで買うとき
c = A*X + B*Y

print(min(a,b,c))
a,b,c,x,y=map(int,input().split())
ans=float("inf")
for i in range(max(x,y)-1):
    t=a*(x-min(x,i))+b*(y-min(y,i))+2*c*i
    ans=min(ans,t)
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - int(k/2))
  j = max(0, Y - int(k/2))
  ans = min(ans, A*i + B*j + C*k)
print(ans)
A,B,C,X,Y = map(int, input().split())
sum_1 = A*X + B*Y
sum_2 = 0
if X > Y:
    sum_2 = A*(X-Y) + C*2*Y
else:
    sum_2 = B*(Y-X) + C*2*X

if sum_2 < sum_1:
    print(sum_2)
else:
    print(sum_1)
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

#ここから書き始める
a, b, c, x, y = map(int, input().split())
ans = min((a + b) * min(x, y), c * min(x, y) * 2)
if x > y:
    ans += min(a * (x - y), c * (x - y) * 2)
else:
    ans += min(a * (y - x), c * (y - x) * 2)
print(ans)
A, B, C, X, Y = map(int, input().split())

ans = 10**7
for i in range(max(X, Y) * 2 + 1):
    c = i
    a = X - i // 2
    if a < 0:
        a = 0
    b = Y - i // 2
    if b < 0:
        b = 0
    v = a * A + b * B + c * C
    if v < ans:
        ans = v

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

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

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

print(ans)
A,B,C,X,Y = map(int, input().split())
ans = 0
if A >= C:
    ans += C*X
    Y -= X
    if Y > 0:
        if B >= C:
            ans += C*Y
        else:
            ans += B*Y
else:
    if B >= C:
        ans += C*Y
        X -= Y
    else:
        ans += B*Y
        X -= Y
    if X > 0:
        ans += A*X
print(ans)
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b,c,x,y = mi()
    ans = 1<<60
    for i in range(max(x,y)):
        ans = min(max(x-i,0)*a+max(y-i,0)*b+2*i*c,ans)
    print(ans)


main()
piza = list(map(int,input().split()))
x = piza[0] * piza[3] + piza[1] * piza[4]
y = piza[2] * 2 * max(piza[3],piza[4])
if piza[3] >= piza[4]:
	z = piza[2] * (2 * piza[4]) + piza[0]*(piza[3]-piza[4])
else:
	z = piza[2] * (2 * piza[3]) + piza[0]*(piza[4]-piza[3])
print(min(x,y,z))
x=input().split()
x=[int(x[i]) for i in range(len(x))]
if x[0]+x[1]<=2*x[2]:
    print(x[0]*x[3]+x[1]*x[4])
else:
    if x[3]>x[4]:
        ans=x[4]*2*x[2]+(x[3]-x[4])*x[0]
        ans=min(ans,x[3]*2*x[2])
    else:
        ans=x[3]*2*x[2]+(x[4]-x[3])*x[0]
        ans=min(ans,x[4]*2*x[2])
    print(ans)
a, b, c, x, y = [int(i) for i in input().split()]

if a > 2*c and b > 2*c:
    ans = 2 * c * max(x,y)
elif a+b > 2*c:
    if x >= y:
        ans = c * 2 * y
        ans += a * (x - y)
    else:
        ans = c * 2 * x
        ans += b * (y - x)
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)
else:
    if x > y:
        if a < c:
            print(2*y*c + (x-y)*a)
        else:
            print(2*x*c)
    else:
        if a < c:
            print(2*x*c + (y-x)*b)
        else:
            print(2*y*c)
# https://atcoder.jp/contests/abc095/tasks/arc096

# 値段,枚数
A, B, C, X, Y = map(int, input().split())

# C * 2 は　A + Bとなる
ans = max(X, Y) * 2 * C

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

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

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

l = a * x + b * y
m = c * max(x, y) * 2

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

ans = min(l, min(m, n))
print(ans)
a,b,c,x,y = map(int,input().split())
ans = 10**12
for i in range(0,int(10e5),2):
  ans=min(ans,(i*(2*c))+(max(0,x-i)*a)+(max(0,y-i)*b))
print(ans)
a,b,c,x,y=map(int,input().split())
ans=float('inf')
for i in range(10**5):
    tmp=i*c*2+a*max(x-i,0)+b*max(y-i,0)
    ans=min(ans,tmp)
print(ans)
A,B,C,X,Y=map(int,input().split())
if Y>=X:
  X,Y=Y,X
  A,B=B,A
if A+B<=C*2:
  print(A*X+B*Y)
else:
  print(Y*2*C+(X-Y)*min(A,B,2*C))
a,b,c,x,y=map(int,input().split())
ans=100000
for i in range(100001):
    tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
    ans=min(ans,tmp)
print(ans)
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)
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())

ans=[a*x+b*y,max(x,y)*c*2,min(x,y)*2*c+min(a,b,2*c)*abs(y-x)]

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

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

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

xn, yn = 0, 0
price = 0

if (A+B) >= 2*C and A >= 1 and B >= 1:
    ammount = min(X, Y)
    price += C * ammount * 2
    xn += ammount
    yn += ammount

if A >= 2*C and X > xn:
    ammount = X - xn
    price += C * X * 2
    xn += X
    yn += X

if B >= 2*C and Y > yn:
    ammount = Y - yn
    price += C * ammount * 2
    xn += ammount
    yn += ammount

price += A * (X - xn)
price += B * (Y - yn)

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

piza_min = min(x,y)

plan1 = c*piza_min*2 + a*(x-piza_min) + b*(y-piza_min)
plan2 = a*x + b*y

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

ans = float('inf')

if A + B > 2 * C:
    p = (2 * max(X, Y)) * C
    ans = min(ans, p)
else:
    for x in range(X + 1):
        for y in range(Y + 1):
            c = max(X - x, Y - y)
            p = x * A + y * B + (2 * c) * C
            ans = min(ans, p)

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

cost_list = []
for i in range(0, max([X, Y]) * 2 + 1, 2):
    AB_cost = C * i
    A_cost = A * (X - int(i / 2))
    B_cost = B * (Y - int(i / 2))
    if A_cost >= 0 and B_cost >= 0:
        cost = AB_cost + A_cost + B_cost
        cost_list.append(cost)

#print(cost_list)
print(min(cost_list))
A,B,C,X,Y=list(map(int,input().split()))
money=0
if min(A,B,2*C)==2*C:
    money+=2*C*max(X,Y)
elif A+B>2*C:
    money+=2*C*min(X,Y)
    if min(X,Y)==X:
        Y-=X
        money+=Y*B
    else:
        X-=Y
        money+=X*A
else:
    money+=A*X
    money+=B*Y
print(money)
a,b,c,x,y=map(int,input().split())

if a+b<=2*c:
    print(a*x+b*y,1)
else:
    if a>c and b>c:
        print(2*max(x,y)*c,2)
    elif a>c and c>b:
        print(2*min(x,y)*c+min(b,c)*(y-x),3)
    elif a<c and b>c:
        print(2*min(x,y)*c+min(a,c)*(x-y),4)
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a, b, c, x, y = map(int, input().split())
    lim = max(x, y)
    ans = 10**8
    for i in range(lim+1):
        price = a*max(0, x-i) + b*max(0, y-i) + c*2*i
        ans = min(ans, price)
    print(ans)

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

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

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

m = 10^9
for i in range(X):
  for j in range(Y):
    m = min(m,A*i+B*j+C*((X+Y)-(i+j)))
    
print(m)
A, B, C, X, Y = map(int, input().split())

ans = A*X + B*Y

i = 1
while True:
    if X-i < 0 or Y-i < 0:
        break
    cost = A*(X-i) + B*(Y-i) + 2*C*i
    if cost > ans:
        break
    ans = min(cost, ans)
    i += 1

print(ans)
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - 2*k)
  j = max(0, Y - 2*k)
  ans = min(ans, A*i + B*j + C*k)
print(ans)
A,B,C,X,Y=map(int,input().split())
if A+B<=C*2:
  print(A*X+B*Y)
elif max(A,B)<=2*C:
  if X>=Y:
    print(Y*2*C+(X-Y)*A)
  else:
    print(X*2*C+(Y-X)*B)
else:
  print(2*Y*C)
a, b, c, x, y = [int(i) for i in input().split()]

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

for i in range(10**8):
    ans = min(ans, a * max(x -i,0) + b * max ( y - i , 0 ) + (2 * c * i)  )

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

for i in range(1, max(x, y) + 1):
    c_price = i * 2 * c
    if x - i <= 0:
        a_price = 0
    else:
        a_price = (x - i) * a
    if y - i <= 0:
        b_price = 0
    else:
        b_price = (y - i) * b
    total.append(a_price + b_price + c_price)
print(min(total))
a,b,c,x,y = map(int, input().split())
ans = 7000000000
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)
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max+1):
    s = a*(x-i)+b*(y-i)+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())
pata = a*x + b*y

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

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

xn, yn = 0, 0
price = 0

if (A+B) >= 2*C:
    ammount = min(X, Y)
    price += C * ammount * 2
    xn += ammount
    yn += ammount

if A >= 2*C and X > xn:
    ammount = X - xn
    price += C * X * 2
    xn += X
    yn += X

if B >= 2*C and Y > yn:
    ammount = Y - yn
    price += C * ammount * 2
    xn += ammount
    yn += ammount

price += A * (X - xn)
price += B * (Y - yn)

print(price)
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
sum = 0

res = A*X + B*Y
for i in range(0,min_):
    sum += C * 2
if(C<0.5*A and C< 0.5*B):
    sum += 2*C*(max_-min_)
elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))
a,b,c,x,y = map(int,input().split())

chp = min(a+b,c*2)
memo1 = min(x,y)
memo2 = max(x,y)-min(x,y)
if x>y:
    print(memo2*a+memo1*chp)
else:
    print(memo2*b+memo1*chp)
a, b, c, x, y = map(int, input().split())
ans = float("inf")
for i in range(max(x, y)):
    ans = min(ans, i * 2 * c + a * max(0, x - i) + b * max(0, y - i))
print(ans)
A, B, C, X, Y = map(int, input().split())

min_price = A * X + B * Y

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

if X > 0 and A > 2 * C:
    min_price -= (A - 2 * C) * X

if Y > 0 and B > 2 * C:
    min_price -= (B - 2 * C) * Y

print(min_price)
a,b,c,x,y = map(int,input().split())
A_B = a*x+b*y
A_AB = a*(x-y)+2*c*y
AB_B = 2*c*x+b*(y-x)
AB = 2*c*max(x,y)
ans = min(A_B,A_AB,AB_B,AB)
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = 0
if (A+B)/2 >= C:
    if X >= Y:
        ans += C * Y * 2
        ans += A * (X-Y)
    else:
        ans += C * X * 2
        ans += B * (Y-X)
else:
    ans = A*X + B*Y
    
print(ans)
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

if a+b <= 2*c:
    mi = a*x+b*y
else:
    mi = min(mi,max(x,y)*2*c)
    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())
ans=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

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

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

print(ans)