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

p1 = 2 * C * min(X, Y) + A * (X - min(X, Y)) + B * (Y - min(X, Y))
p2 = 2 * C * max(X, Y)
p3 = A * X + B * Y
print(min(p1, p2, p3))
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*x)
    li.append(pab*2*y)
li.sort()
print(li[0])
a,b,c,x,y  = map(int,input().split())
if a+b > c*2:
    mmm = min(x,y)
    aaa = max(x,y)
    if (x > y and a<=2*c):
        print(c*2*mmm + a*(aaa-mmm))
    elif (x > y and a>2*c):
        print(c*2*aaa)
    elif (x <= y and b<=2*c):
        print(c*2*mmm + b*(aaa-mmm))
    elif (x <= y and b>2*c):
        print(c*2*aaa)
else:
    print(a*x + b*y)
A,B,C,X,Y = map(int,input().split())
a = min(X,Y)
b = max(X,Y)
if A+B>=2*C:
    ans = a*2*C
    if X>=Y:
        ans += (X-Y)*min(A,2*C)
    else:
        ans += (Y-X)*min(B,2*C)
else:
    ans = A*X+B*Y
print(ans)
a,b,c,x,y=map(int,input().split())

yenmin=a*x+b*y
for zz in range(2*10**5+1):
    xx=max(x-zz//2,0)
    yy=max(y-zz//2,0)
    yen=a*xx+b*yy+c*zz
    if yen<yenmin:
        yenmin=yen
print(yenmin)
#print(xx,yy,zz)
a, b, c, x, y = list(map(int, input().split(' ')))

d = c * 2


ans = 1 << 30
# ABを何枚
for i in range(max(x, y) + 1):
    rx = max(x - i, 0)
    ry = max(y - i, 0)
    ans = min(ans,  i * d + rx * a + ry * b)
print(ans)
import sys
readline = sys.stdin.buffer.readline

def main():
    A, B, C, X, Y = map(int, readline().rstrip().split())
    if A + B <= 2 * C:
        print(X * A + Y * B)
        return
    
    m = min(X, Y)
    ans = m * 2 * C
    X -= m
    Y -= m
    ans += min(X * A + Y * B, max(X, Y) * 2 * C)
    
    print(ans)


if __name__ == '__main__':
    main()
# C - Half and Half

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

# 条件を満たすときのA, B, ABの買い方を全列挙したい
# A, Bの枚数は、ABの値が決まれば、一意に定まるため、
# ABのみループする。

ans = 10**18
for i in range(0, max(X, Y)*2+1, 2):
    x = max(X-i//2, 0)
    y = max(Y-i//2, 0)
    ans = min(ans, x*A + y*B + i*C)
    
print(ans)
a,b,c,x,y = map(int, input().split())
cost = {x:a, y:b}
s = min(x,y) * c * 2 + abs(x - y) * cost[max(x,y)]
t = max(x,y) * c * 2
u = a * x + b * y

print(min([s, t, u]))
A,B,C,X,Y = map(int, input().split())

if X <= Y:
  S = B
  Z = X
  W = Y
else:
  S = A
  Z = Y
  W = X
  
if 2*C > A+B:
  print(A*X+B*Y)

elif 2*C > S:
  print((2*C-S)*Z + S*W)
  
else:
  print(2*C*W)
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())
ab = 2*c
i = 0
cost = 0
minCost = 10**10
while i < 10**6:
    cost = i*ab
    cost += a *(max(0, (x-i)))
    cost += b *(max(0, (y-i)))
    if minCost >= cost:
        minCost = cost
    i += 1
print(minCost)
A,B,C,X,Y = map(int,input().split())
ans = float("inf")
for i in range(0,2*max(X,Y)+2,2):
    yen = A*max(0,X-(i//2))+C*i+B*max(0,Y-(i//2))
    ans = min(ans,yen)
print(ans)
A,B,C,X,Y = map(int,input().split())

z = max(X,Y)*2

act_list = []
for i in range(0,z+1,2):
    x = int(X - i*0.5)
    y = int(Y - i*0.5)
    
    if x <= 0:
        x = 0
    if y <= 0:
        y = 0
    act = x * A + y * B + i * C
    act_list.append(act)

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

if 2*c < a+b:
    if x < y:
        ans = 2*c * x + min(2*c, b) * (y - x)
    else:
        ans = 2*c * y + min(2*c, a) * (x - y)
else:
    ans = a * x + b * y
print(ans)
A, B, C, X, Y = map(int,input().split())
import math
price_min = -1
for ab in [0, 2*X, 2*Y]:
    X_need = X - 0.5*ab
    Y_need = Y - 0.5*ab
    if X_need < 0:
        X_need = 0
    if Y_need < 0:
        Y_need = 0
    price = ab * C + A * math.ceil(X_need) + B * math.ceil(Y_need)
    if price_min == -1:
        price_min = price
    else:
        price_min = min(price, price_min)
print(price_min)
A,B,C,X,Y = (int(i) for i in input().split())

AB_optimal = min(A+B, C*2)
A_optimal = min(A,C*2)
B_optimal = min(B,C*2)

XY_diff = abs(X-Y)

ans = 0
if X>=Y:
  ans += (X-XY_diff) * AB_optimal
  ans += XY_diff * A_optimal
else:
  ans += (Y-XY_diff) * AB_optimal
  ans += XY_diff * B_optimal

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

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

print(ans)
# coding: utf-8

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


n = 10 ** 10
min_a = min_b = min_c = 10**10
max_ab = 0
for ab in range(0, 2*max(X, Y) + 2, 2):
    a = max(X - ab//2, 0)
    b = max(Y - ab//2, 0)
    n = min(n, a*A + b*B + ab*C)

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

def best_pizza_cost(ln, hn):
    if ln == X: lp = A
    else: lp = B

    if hn == Y: hp = B
    else: hp = A

    fnp = lp * ln + hp * ln
    fhp = C * ln * 2

    left = hn-ln
    snp = hp * left
    shp = C * left * 2
    #print(fnp, fhp, snp, shp)
    return min(fnp, fhp) + min(snp, shp)

print(best_pizza_cost(min(X, Y), max(X, Y)))
a,b,c,x,y = map(int,input().split())
print(min(a*x+b*y,2*c*min(x,y)+abs(x-y)*(a if max(x,y)==x else b),2*c*min(x,y)+abs(x-y)*2*c))
a,b,c,x,y = map(int,input().split())

n = a*x+b*y

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

if x<y:
    p = b
else:
    p = a

l = 2*c*min(x,y) + p*abs(x-y)

ans = min(n,min(m,l))

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

e=max(x,y)
ans1=e*(2*c)
if 2*c<a+b:
    d=min(x,y)
    ans+=c*(2*d)
    x-=d
    y-=d
else:
    ans=a*x+b*y
    x-=x
    y-=y
ans+=x*a
ans+=y*b
print(min(ans,ans1))
A,B,C,X,Y=map(int,input().split())
anlist=[]
for i in range(10**5+1):
  ans=2*C*i+A*max(0,X-i)+B*max(0,Y-i)
  anlist.append(ans)
print(min(anlist))
import math
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):


    base = min([x,y])

    values = []
    for index in range(base+1):
        tmp = 2 * C * index + a * (x - index) + b * (y - index)
        values.append(tmp)

    s2 = max([x,y]) * 2 * c
    values.append(s2)

    print(min(values))

calculate(A,B,C,X,Y)
A,B,C,X,Y = map(int, open(0).read().split())
ans=float('inf')
for i in range(max(X,Y) + 1):
    now=2*C*i+max(0,X-i)*A+max(0,Y-i)*B
    ans=min(ans,now)
print(ans)
A,B,C,X,Y = map(int,input().split())

ans = A * X + B * Y

if X>=Y:
    ans1 = C * Y *2 + A * (X-Y)
    ans2 = C * X * 2
else:
    ans1 = C * X * 2 + B * (Y-X)
    ans2 = C * Y *2

print(min(ans, ans1,ans2))
A, B, C, X, Y = map(int, input().split())
ans = 10**10
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)
A, B, C, X, Y = map(int, input().split())
ans = A*X+B*Y
for i in range(1, max(X, Y)+1):
    if i <= min(X, Y):
        ans = min(ans, ans+2*C-(A+B))
    else:
        if X > Y:
            ans = min(ans, ans-A+2*C)
        else:
            ans = min(ans, ans-B+2*C)
print(ans)
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
  print(a*x+b*y)
elif x>=y:
  print(min(y*2*c+(x-y)*a,x*2*c))
else:
  print(min(x*2*c+(y-x)*b,y*2*c))
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 0
z = min(x,y)
if x >= y:
    w = x-z
    v = a
else:
    w = y-z
    v = b

ans += min(a+b,c)*z

ans += min(v,c)*w

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

value = a+b
values = c*2

ans = 0

if value <= values:
    ans += a*x + b*y
    print(ans)
    exit()

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

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


moneys=[]
for i in range(0,max(x,y)*2+1,2):
    apizza=x-int(i/2)
    bpizza=y-int(i/2)
    if apizza<0:
        apizza=0
    if bpizza<0:
        bpizza=0
    money=apizza*a+bpizza*b+i*c
    moneys.append(money)

print(min(moneys))
A,B,C,x,y = map(int,input().split())
ans = 0
if A+B > 2*C:
    ans += min(x,y)*C*2
else:
    ans += x*A + y*B
    print(ans)
    exit()    

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

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

ans = 0
if A + B < 2*AB:
    ans += min(X,Y) * (A+B)
else:
    ans += min(X,Y) * 2 * AB

X, Y = X-min(X,Y), Y-min(X,Y)

if X > 0:
    ans += min(X*A, 2*X*AB)
else:
    ans += min(Y*B, 2*Y*AB)

print(ans)
def main():
    import math

    a, b, c, x, y = map(int, input().split())
    d = [a, b]
    i, j = min(x, y), max(x, y)
    n = math.ceil(i / 2)
    f = j == x
    if 2 * c > (a + b):
        ans = a * x + b * y
    else:
        ans = 2 * c * i + (j - i) * min(c * 2, d[not f])

    print(ans)


if __name__ == '__main__':
    main()
A, B, C, X, Y = map(int, input().split())
ans = A * X + B * Y
for i in range(1, max(X, Y) + 1):
    ab_n = i * 2
    mix = C * ab_n + A * max(0, X - i) + B * max(0, Y - i)
    ans = min(ans, mix)
print(ans)
import sys
input = sys.stdin.readline
a,b,c,x,y=map(int,input().split())

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

ans = 10**10
for ab in range(max(X, Y) * 2 + 10):
    price = C * ab + max(0, X - ab // 2) * A + max(0, Y - ab // 2) * B
    ans = min(ans, price)

print(ans)
a,b,c,x,y = map(int, input().split())
d = (a if x > y else b)
print(min(a*x + b*y,min(x,y)*2*c + d*abs(x-y),max(x,y)*2*c))
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)
a, b, c, x, y = (map(int, input().split()))
candi = []
for i in range(200001):
    candi.append((c*i)+max(0,(x-(i//2)))*a+max(0,(y-(i//2)))*b)
print(min(candi))
a,b,c,x,y = map(int,input().split())
ans = 0
if (a+b) >= (2*c):
  ans += 2*c*min(x,y)
  if (x > y) and (a > 2*c):
    ans += 2*c*(x-y)
  elif (x > y) and (a <= 2*c):
    ans += a*(x-y)
  elif (x < y) and (b > 2*c):
    ans += 2*c*(y-x)
  elif (x < y) and (b <= 2*c):
    ans += b*(y-x)
else:
  ans += a*x+b*y

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

if a + b >= c * 2:
    if x < y:
        temp = a
        a = b
        b = temp
        temp = x
        x = y
        y = temp
    
    if a > 2 * c:
        ans = x * 2 * c
    else:
        ans = y * 2 * c + a * (x - y)
else:
    ans = a * x + b * y
print(ans)
import sys
input = sys.stdin.readline
A,B,C,X,Y = [int(i) for i in input().split()]
money = A * X + B * Y
ans = money
m = min(X,Y)
M = max(X,Y)
d = M - m
if A + B > C * 2 :
    for i in range(m) :
        ans = ans -( A + B) + (2 * C)
    if m == X :
        if B * d > C * 2 * d :
            ans =ans - (B * d) + C * 2 * d
    else :
        if A * d > C * 2 * d :
            ans = ans -(A * d) + C * 2 * d
print(ans)
import math
A,B,C,X,Y = map(int,input().split())
ans = A * X + B * Y
for c in range(2 * 10 ** 5 + 1):
    a = math.ceil(X - c * 0.5)
    b = math.ceil(Y - c * 0.5)
    if a < 0:
        a = 0
    if b < 0:
        b = 0
    mny = a * A + b * B + c * C
    if mny < ans:
        ans = mny
print(ans)
#n=int(input())
A,B,C,X,Y=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
mn=A*X+B*Y
for i in range(max(X,Y)+1):
    mn=min(mn,2*i*C+A*max(0,X-i)+B*max(0,Y-i))

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

ans = 5000 * 2 * (10**10)
for i in range((10 ** 5) + 1):
    check = 2*c*i + max(x-i,0)*a + max(y-i,0)*b
    if(ans > check):
        ans = check
print(ans)
#関数リスト
import sys
input = sys.stdin.readline


def RD(): return input().rstrip()
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))

def main():
    A, B, C, X, Y = MI()
    result = float('inf')
    result = min(result,int(A*X+B*Y))
    temp = min(X,Y)
    result = min(result,int(C*temp*2+(X-temp)*A+(Y-temp)*B))
    result = min(result, int(max(X, Y)*C*2))
    print(result)
    
    
if __name__ == "__main__":
    main()
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def main():
    a, b, c, x, y = map(int, input().split())
    case1 = a * x + b * y
    if x - y > 0:
        case2 = c * 2 * y + a * (x - y)
    else:
        case2 = c * 2 * y
    if y - x > 0:
        case3 = c * 2 * x + b * (y - x)
    else:
        case3 = c * 2 * x
    print(min(case1, case2, case3))


if __name__ == '__main__':
    main()
A,B,C,X,Y=map(int,input().split())
print(min(A*X+B*Y,min(2*C*X+B*max(Y-X,0),A*max(X-Y,0)+2*C*Y)))
A,B,C,X,Y = map(int,input().split())
ans = float('inf')
for i in range(0,2*max(X+1,Y+1)):
    cnt = 0
    a = X - i//2
    b = Y - i//2
    if a<=0:
      a = 0
    if b<= 0:
      b =0
      
    cnt += (a)*A + C*i+(b)*B
    ans  = min(ans,cnt)
print(ans)
A, B, C, X, Y = map(int, input().split())

MAX = max(X, Y)
MIN = 2*C*max(X, Y)
i = MAX
x=X
y=Y

while i > 0:
    tmpC = (MAX-i)*2*C
    total = (A*x)+(B*y)+tmpC
    if(MIN > total):
        MIN = total
    i-=1
    if(x!=0):
        x-=1
    if(y!=0):
        y-=1

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

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

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

    ans1 = x*a + y*b
    min_num = min(x, y)
    max_num = max(x, y)
    x, y = x-min_num, y-min_num
    ans2 = min_num*c*2 + max(x, 0)*a + max(y, 0)*b
    ans3 = max_num*c*2
    ans = min(ans1, ans2, ans3)
    print(ans)


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

a=min(X,Y)*min(A+B,2*C)

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


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

if X == Y :
  print( X* min( cost1, cost2))
elif X > Y:
  a = Y * min( cost1, cost2) + ( X - Y) * A
  b = X * min( cost1, cost2)
  print( min( a, b))
else :
  a = X * min( cost1, cost2) + ( Y - X) * B
  b = Y * min( cost1, cost2)
  print( min(a,b))
A, B, C, X, Y = map(int, input().split())
ans = 2*(5000*10**5)
for Z in range(10**5+1):
    total = A*max(X-Z, 0)+B*max(Y-Z, 0)+2*C*Z
    ans = min(total,ans)
print(ans)
A, B, C, X, Y = input().split(' ')
A = int(A)
B = int(B)
C = int(C)
X = int(X)
Y = int(Y)
if A > 2*C:
  A = 2*C
if B > 2*C:
  B = 2*C
if A + B <= 2*C:
  print(A*X+B*Y)
else:
  if X > Y:
    sum = (X-Y)*A + Y*2*C
  else:
    sum = (Y-X)*B + X*2*C
  print(sum)
a, b, c, x, y = map(int, input().split())

ans = 10 ** 18
for i in range(0, 2 * max(x, y) + 1, 2):
    tmp = i * c
    if x - i // 2 > 0:
        tmp += (x - i // 2) * a
    if y - i // 2 > 0:
        tmp += (y - i // 2) * b
    ans = min(ans, tmp)
print(ans)
import math

def main():
    A,B,C,X,Y = [int(x) for x in input().split()]
    ans = 0
    if A+B <= C*2:
        # print('b')
        ans = A*X + B*Y
    else:
        if X<=Y:
            # print('c')
            ans = C*X*2 + min(B,C*2)*(Y-X)
        elif X>Y:
            # print('d')
            ans = C*Y*2 + min(A,C*2)*(X-Y)
    print(ans)

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

result = float('inf')
for i in range(0, max(X, Y)+1):
    tmp = C*2*i + max(0, X-i) * A + max(0, Y-i) * B
    if tmp < result:
        result = tmp
print(result)
A, B, C, X, Y = map(int, input().split())

cost = 0

ab = min(X, Y)
cost += min(ab * 2 * C, (A + B) * ab)
X -= ab
Y -= ab

cost += min(C * 2, A) * X
cost += min(C * 2, B) * Y

print(cost)
A,B,C,X,Y = (int(X) for X in input().split())
MINPrice = pow(10,9)
for ABP in range(0,2*max(X,Y)+1,2):
    Price = A*max(0,(X-ABP//2))+B*max(0,(Y-ABP//2))+C*ABP
    if Price<=MINPrice:
        MINPrice = Price
print(MINPrice)
A,B,C,X,Y = map(int,input().split())

plan1 = (A*X) + (B*Y)
plan2 = (C*2) * max(X,Y)
plan3 = (C*2) * X + B*(Y-X)
plan4 = (C*2) * Y + A*(X-Y)

if X <= Y:
  print(min(plan1,plan2,plan3))
else:
  print(min(plan1,plan2,plan4))
A,B,C,X,Y = map(int,input().split())

ans = 2*max(X,Y)*C
ans = min(ans,A*X+B*Y)
if X>=Y:ans = min(ans,2*Y*C+(X-Y)*A)
else:ans = min(ans,2*X*C+(Y-X)*B)
print(ans)
# abc_95_c
# import sys
from sys import stdin
A, B, C, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = 0
# ans2 = 0
if C < (A/2)+(B/2):
    if X > Y:
        ans1 = C*2*min(X, Y)+(max(X, Y)-min(X, Y))*A
    else:
        ans1 = C*2*min(X, Y)+(max(X, Y)-min(X, Y))*B
else:
    ans1 = A*X+B*Y
ans2 = C*2*max(X, Y)
print(min(ans1, ans2))
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
else:
    n = Y - n
    sum = sum + n*B

sum_ab = X*A + Y*B

sum_a_b = 2*max(X,Y)*C


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

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

print(min(A, B, C))
# C
a, b, c, x, y = map(int, input().split())

ans = 0
while min(x,y) != 0:
    if min(x, y) == x:
        ans += x*min(a+b, 2*c)
        y -= x
        x = 0
    elif min(x, y) == y:
        ans += y*min(a+b, 2*c)
        x = x - y
        y = 0
        
if x == 0:
    ans += y*min(b, 2*c)
elif y == 0:
    ans += x*min(a, 2*c)
    
print(ans)
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,max(x,y)*2*c)
    print(ans)

if __name__ == '__main__':
    resolve()
a, b, ab, x, y = [int(i) for i in input().split()]

if a + b < 2 * ab:
    print(a * x + b * y)

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

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

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

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

print(ans)
def main():
    A, B, AB, X, Y = map(int, input().split())
    M = max(X, Y)

    k = 0
    ans = A * X + B * Y
    while True:
        ans = min(
            ans,
            AB * k * 2 + max(0, X - k) * A + max(0, Y - k) * B
        )

        if k >= M: break
        k += 1

    print(ans)


if __name__ == '__main__':
    main()
[a,b,c,x,y] = [int(x) for x in input().split()]

total_price = a*x+b*y
max_num = max(x,y)

for i in range(0,(max_num+1)*2,2):
    new_x = 0 if x-i//2 <= 0 else x-i//2
    new_y = 0 if y-i//2 <= 0 else y-i//2
    current_price = i*c + new_x*a + new_y*b
    
    if current_price < total_price:
        total_price = current_price

print(total_price)
a,b,c,x,y = map(int,input().split())
ans = 10**18
for i in range(10**5+1):
    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(lambda x: int(x), input().split())
price = A * X + B * Y
for Z in range(2, X * 2 + 1 if X > Y else Y * 2 + 1, 2):
    x, y = int(X - Z / 2), int(Y - Z / 2)
    x, y = 0 if x < 0 else x, 0 if y < 0 else y
    next_price = A * x + B * y + C * Z
    if next_price >= price:
        break
    price = next_price
print(price)
import sys
import math
ans = float('inf')
a,b,c,x,y = map(int,sys.stdin.readline().rstrip().split())
for i in range(max(x,y)+1):
  if x > y and i >= y:
  	sum = a * (x - i) +  2 * i * c
  elif y > x and i >= x:
    sum = b * (y - i) + 2 * i * c
  else:
    sum = a * (x - i) + b * (y - i) + 2 * i * c
  ans = min(ans,sum)
print(ans)
A, B, C, X, Y = map(int, input().split())
D = {X:A, Y:B}

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

ans = float('inf')
for i in range(10**5 + 1):
    tmp = c*2*i + 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 = float('inf')
for i in range(0,max(X,Y)*2+1,2):
    s = 0
    x = X-i//2
    y = Y-i//2
    if x >= 1:
        s += x*A 
    if y >= 1:
        s += y*B
    s += i*C
    ans = min(ans, s)
print(ans)
A, B, C, X, Y = list(map(int,input().split()))
ans = float('Inf')
for i in range(max(X,Y)*2+1):
    tmp = i * C
    if i / 2 < X:
        tmp += A*(X-i//2)
    if i / 2 < Y:
        tmp += B*(Y-i//2)
    ans = min(ans,tmp)
print(ans)
a,b,c,x,y=[int(i) for i in input().split()]

#直接買ったほうが安いとき

if a+b<c*2:
    print(a*x+b*y)
    
#AピザよりもABピザ２枚のほうが安い
elif a+b>=c*2:
    if x-y>0 and a<=2*c:
        print(2*c*y+(x-y)*a)
    elif y-x>0 and b<=2*c:
        print(2*c*x+(y-x)*b)
    elif x-y>0:
        print(x*2*c)
    else:
        print(y*2*c)
A, B, C, X, Y = map(int, input().split())
ans = 0
if (A+B)/2 >= C:
    if X >= Y:
        if A/2 <= C:
            ans += C * Y * 2
            ans += A * (X-Y)
        else:
            ans += C * X * 2
    else:
        if B/2 <= C:
            ans += C * X * 2
            ans += B * (Y-X)
        
        else:
            ans += C * Y *2
else:
    ans = A*X + B*Y
    
print(ans)
A,B,C,X,Y = list(map(int,input().split()))

if C*2 <= A+B:
    ans = 0
    ans += C*2*min(X,Y)
    ans += min(A,C*2)*(X-Y) if Y<X else min(B,C*2)*(Y-X)
    print(ans)
else:
    print(A*X+B*Y)
a,b,c,x,y=map(int,input().split())
z,w=min(x,y),max(x,y)
print(min(min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2),c*2*w))
import numpy as np
A, B, C, X, Y = list(map(int, input().split()))

min_money = A*X + B*Y

status = np.array([X,Y,0])
delta_status = np.array([-1,-1,2])
block_status = np.array([0,0,0])
values = np.array([A,B,C])

for _ in range(max(X,Y)):
    status += delta_status
    status = np.max(np.array([status,block_status]), axis=0)
    
    tmp_money = sum(status * values)
    min_money = min(tmp_money,min_money)
print(min_money)
a,b,c,x,y = map(int,input().split())
xy = max(x,y)*2+1
print(min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)]))
a,b,c,x,y=map(int,input().split())
ans=1000000000000000000000000
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())

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

non_AB = A*X + B*Y
if X>Y:
#BをABから作る
    non_B = C*2*Y + A*(X-Y)
#AをABから作る
    non_A = C*2*X
else:
    non_A = C*2*X + B*(Y-X)
    non_B = C*2*Y


# print(min(non_AB, use_AB))
print(min(non_AB, non_A, non_B))
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*2
    x-=y
    if a>=c*2:
        ans+=c*2*x
    else:
        ans+=a*x
elif y>x:
    ans+=c*x*2
    y-=x
    if b>=c*2:
        ans+=c*2*y
    else:
        ans+=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:
        A, B, X, Y = B, A, Y, X
    print(2 * X * C + (Y - X) * min(B, 2 * C))
a,b,c,x,y = map(int,input().split())
l = min(x,y)
m = max(x,y)
M = a * x + b * y
for i in range(1,l+1):
  K = a * (x-i) + b * (y-i) + 2 * c * i #これだとマイナスになってしまう
  M = min(M,K)
for i in range(l+1,m+1):
  if x == l:
    K = b * (y-i) + 2 * c * i
  else:
    K = a * (x-i) + 2 * c * i
  M = min(M,K)
print(M)
a, b, c, x, y = map(int, input().split())

high = max(x, y)
low = min(x, y)

if a + b <= c * 2:
	res = a * x + b * y
else:
	if high == x:
		res = low * c*2 + (high - low) * a
	else:
		res = low * c*2 + (high - low) * b
	res = min( res, c*2 * high )
print(res)