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

if A+B > 2*C:
  if X < Y:
    if 2*C <= B:
      Sum = C * 2 * Y
    else:
      Sum = C * 2 * X + B * (Y - X)
  elif Y < X:
    if 2*C <= A:
      Sum = C * 2 * X
    else:
      Sum = C * 2 * Y + A * (X - Y)
  else:
    Sum = C * 2 * X

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

if a + b <= 2*c:
    print(a*x+b*y)
else:
    ab_cnt = min(x,y)
    remain_a = x-ab_cnt
    remain_b = y-ab_cnt


    if remain_a > 0 and a > 2*c:
        print(ab_cnt*2*c + remain_a*2*c)
    elif remain_b > 0 and b > 2*c:
        print(ab_cnt*2*c + remain_b*2*c)
    else:
        print(ab_cnt*2*c + remain_a*a + remain_b*b)
a, b, c, x, y = map(int, input().split())
# 3通り
# 1: ax+by
# 2: 2c*large
# 3: 2c*small + (a/b) * diff

tar1 = a * x + b * y
tar2 = 2 * c * max(x, y)

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


ans = min(tar1, tar2, tar3)


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

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

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

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

print(ans)
# 単体ピザで埋めてからハーフピザを買うか、
# ハーフピザで埋めてから単体ピザを足すのが良いはず。

A, B, C, X, Y = map(int, input().split())
a, b = X, Y
est = []

#ハーフ埋め
esth = C * min(X, Y) * 2
a -= min(X,Y)
b -= min(X,Y)
esth += A * a + B * b
est.append(esth)

#全ハーフ
a, b = X, Y
estah = C * max(X, Y) * 2
est.append(estah)

#全単品
a, b = X, Y
estfa = A * a + B * b
est.append(estfa)

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

ans = min(A * X + B * Y,
          B * max(0, Y - X) + C * X * 2,
          A * max(0, X - Y) + C * Y * 2)
print(ans)
a,b,c,x,y = map(int,input().split())
d = c * 2 #aピザ1枚とbピザ1枚
if a + b < d:
    print(x * a + y * b)
    exit()
elif x >= y:
    tmp1 = y * d + (x - y) * a
    tmp2 = x * d
    print(min(tmp1, tmp2))
elif y > x:
    tmp1 = x * d + (y - x) * b
    tmp2 = y * d
    print(min(tmp1, tmp2))
import math

line = input().split()
a = int(line[0])
b = int(line[1])
c = int(line[2])
x = int(line[3])
y = int(line[4])

m = max(x, y)
price = a * x + b * y

for i in range(1 ,m + 1):
  tx = max(x - i, 0)
  ty = max(y - i, 0)  
  tprice = i * 2 * c + a * tx + b * ty
  if tprice < price:
    price = tprice

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:
        ans=2*c*y
        rem=x-y
        ans+=min(2*rem*c,rem*a)
    elif x<y:
        ans=2*c*x
        rem=y-x
        ans+=min(2*rem*c,rem*b)
    else:ans=2*c*x
    print(ans)
#ABC095C 全列挙
def main():
    import sys, math
    A,B,C,X,Y = map(int, sys.stdin.readline().split())
    ans = float('inf')
    for i in range(10**5+1):
        tmp = i*2*C + max(0, (X-i)*A) + max(0, (Y-i)*B)
        ans = min(tmp, ans)
        if i > X and i > Y:
            break
    print(ans)  

if __name__=='__main__':
    main()
a,b,c,x,y=map(int,input().split())
ans=float('inf')
for i in range(10**5+1):
    temp=i*2*c + max(0,x-i)*a +max(0,y-i)*b
    ans=min(ans,temp)
print(ans)
a, b, c, x, y = list(map(int, input().split()))

ans = 0
for i in range(0, max(x,y)+1):
    s = a*max(0,x-i)+b*max(0,y-i)+c*2*i
    if ans == 0:
      ans = s
    else:
      ans = min(ans,s)
    
print(ans)
a,b,c,x,y = map(int, input().split())
k1 = a*x+b*y
k2 = 2*c*max(x,y)
if x < y:
  k3 = 2*c*min(x,y)+b*(y-x)
else:
  k3 = 2*c*min(x,y)+a*(x-y)

print(min(k1, k2, k3))
a,b,c,x,y=map(int,input().split())
ans=1000000000
for i in range (0,(max(x,y)*2+1),2):#abピザを何枚買ったか考える。偶数枚しかありえないことに注意
  price=c*i+a*(max(0,(x-int(i/2))))+b*(max(0,(y-int(i/2))))
  ans =min(price,ans)
  #abピザの枚数が決まると残りは単品による購入となるので、
  #自動的に購入枚数は決定する。O(n)全探索で済むので間に合う。
  
print(ans)
def main():
    A, B, C, X, Y = map(int, input().split())
    M1 = A*X + B*Y
    M2 = C*2*min(X, Y) + (Y >= X) * (Y - X) * B + (X > Y) * (X - Y) * A
    M3 = C*2*max(X, Y)
    ans = min(M1, M2, M3)
    print(ans)


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

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

print(min(ans1, ans2, ans3))
a,b,c,x,y=map(int,input().split())
if (a+b)/2>c:
	C=min(x,y)*2
	if x>y:
		if 2*c>a:
			print(a*(x-y)+c*C)
		else:
			print(c*max(x,y)*2)
	else:
		if 2*c>b:
			print(b*(y-x)+c*C)
		else:
			print(c*max(x,y)*2)
else:
	print(a*x+b*y)
def resolve():
  a, b, c, x, y = map(int, input().split())
  ans = a * x + b * y
  ans = min(ans, max(x, y) * c * 2)
  if x >= y:
    ans = min(ans, y * c * 2 + (x - y) * a)
  else:
    ans = min(ans, x * c * 2 + (y - x) * b)

  print(ans)
  return

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

#全部ABピザで買う
ans1=c*max(x,y)*2

#AピザX個、BピザをY個、それぞれ買う
ans2=a*x+b*y

#X、Yの少ない方までABピザを買い、足りない分を買う
if(x<=y):
  ans3=c*x*2+(y-x)*b
else:
  ans3=c*y*2+(x-y)*a

print(min(ans1,ans2,ans3))
a, b, c, x, y = map(int, input().split())
mi, ma = min(x, y), max(x, y)
print(int(min(mi * c * 2 + a * (x-mi) + b * (y-mi),
              ma * c * 2,
              x * a + y * b)))
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,y*2*c+(x-y)*a)
else:
    mi = min(mi,x*2*c+(y-x)*b)

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

print(ans)
A,B,AB,X,Y=map(int,input().split())
ans1=A*X+B*Y
ans2=2*AB*max(X,Y)
if X<Y:
    ans3=2*AB*X+B*(Y-X)
else:
    ans3=2*AB*Y+A*(X-Y)
print(min(ans1,ans2,ans3))
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b,c,x,y = map(int,input().split())
"""
AとBのみ
"""
cost = x*a + y*b
"""
ABと個数あわせ
"""
cost2 = c*2*min(x,y)
if x>y:
    cost2 += (x-y)*a
else:
    cost2 += (y-x)*b
"""
ABのみ
"""
cost3 = c*2*max(x,y)
ans = min(cost,cost2)
ans = min(ans,cost3)
print(ans)
a,b,c,x,y = map(int, input().split())

if a+b <= 2*c:
	print(a*x + b*y)
else:
	#買えるだけABピザを買う
	z = min(x,y)
	res = c * 2 * z
	#残り
	if x>=y:
		cand1 = (x-z)*a
	else:
		cand1 = (y-z)*b
	cand2 = (max(x,y)-z)*2*c
	print(min(cand1,cand2) + res)
A, B, C, X, Y = map(int, input().split())

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

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

for i in range(0, 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))
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**6)
for c in range(1+max([2*x,2*y])):
    a=0
    b=0
    if x>c/2:
        a=math.ceil(x-(c/2))
    if y>c/2:
        b=math.ceil(y-(c/2))
    if A*a+B*b+C*c<price:
        price=A*a+B*b+C*c
print(price)
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 and x >= y:
  print(x * 2 * c)
elif a >= 2 * c and x < y:
  print(x * 2 * c + (y - x) * b)
elif b >= 2 * c and x <= y:
  print(y * 2 * c)
elif b >= 2 * c and x > y:
  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())

cost = float("inf")
for i in range(100001):
    tc = c * i * 2 + max(a * (x - i), 0) + max(b * (y - i), 0)

    cost = min(cost, tc)

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

pizza = {X : A, Y : B}
ans = 0

for i in range(max(X, Y)):
    if i <= min(X, Y) - 1:
        ans += min(A + B, 2 * C)
    else:
        ans += min(pizza[max(X, Y)], 2 * C)

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

#貪欲で全てのケースを用意する。

ans = 0

ans += a*x + b*y

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

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

print(ans)
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:
        pass
    elif x > y and a < 2 * c:
        ans += a * (x - y)
    elif x < y and b < 2 * c:
        ans += b * (y - x)
    else:
        ans += 2 * c * abs(x - y)
else:
    ans = a * x + b * y
print(ans)
a,b,c,x,y=map(int,input().split())
print(min(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)),a*x+b*y))
A, B, C, X, Y = map(int, input().split())
inf = float('inf')
amount = inf

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

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

ans += A * max(0, X)
ans += B * max(0, Y)

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

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

# 偏り分
if 2 * C < A:
    k = X
    X -= k
    Y -= k
    ans += 2 * C * k
if 2 * C < B:
    k = Y
    X -= k
    Y -= k
    ans += 2 * C * k

# あまり分
ans += A * max(0, X) + B * max(0, Y)
print(ans)
def LI(): return list(map(int,input().split()))
A,B,C,X,Y = LI()
ans = float('INF')
for i in range(max(X,Y)+1):
    price = A*max(X-i,0)+B*max(Y-i,0)+C*2*i
    ans = min(price,ans)
print(ans)
a, b, c, x, y = map(int,input().split())

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

while s:
    tmp = 0
    tmp -= c*2
    s -= 1
    if x > s:
        tmp += a
    if y > s:
        tmp += b
    if tmp > 0:
        print(ans)
        exit()
    else:
        ans += tmp
        
print(ans)
def main():
    a, b, ab, x, y = map(int, input().split())
    # abをx枚買うかy枚買うか、0枚買うかの3パターン
    ab *= 2
    ab_x = ab * x + b * max((y - x), 0)
    ab_y = ab * y + a * max((x - y), 0)
    ab_0 = a * x + b * y
    print(min(ab_x, ab_y, ab_0))


if __name__ == "__main__":
    main()
import sys


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


sys.setrecursionlimit(10 ** 9)


def main():
    A, B, C, X, Y = map(int, input().split())
    money = []
    money.append(X * A + Y * B)
    if X > Y:
        money.append(X * 2 * C)
        money.append(Y * 2 * C + (X - Y) * A)
    elif X == Y:
        money.append(X * 2 * C)
    else:
        money.append(Y * 2 * C)
        money.append(X * 2 * C + (Y - X) * B)
    print(min(money))


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

price = X * A + Y * B
for a in [0,abs(X-Y),X]:
    for b in [0,abs(X-Y),Y]:
        c = max(X-a,Y-b)*2
        price = min(price,a*A + b*B + c*C)

print(price)
a, b, c, x, y = map(int, input().split())
same = 0
diff = 0
if x>y:
    diff=min(a*(x-y), 2*c*(x-y))
    same = y
elif y>x:
    diff=min(b*(y-x), 2*c*(y-x))
    same = x
else:
    same = x
print(min((a+b)*same, 2*c*same) + diff)
a,b,c,x,y=map(int,input().split())
z=min(x,y)
z_max=max(x,y)
cost=0

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

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

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

print(ans)
A, B, C, X, Y = map(int, input().split())
if C*2>=A+B:
  ans = A*X+B*Y
else:
  ans = min(C*2*max(X,Y),C*2*min(X,Y)+A*max(0,X-Y)+B*max(0,Y-X))
print(ans)
A,B,C,X,Y=map(int,input().split())
key=A/2+B/2
if C>=key:
  print(A*X+B*Y)
else:
  if X>=Y:
    Key=X-Y
    if Key*C*2<=Key*A:
      print(C*2*X)
    else:
      print(C*2*Y+A*Key)
  else:
    Key=Y-X
    if Key*C*2<=Key*B:
      print(C*2*Y)
    else:
      print(C*2*X+B*Key)
a,b,c,x,y = map(int,input().split())
ans = 2000000000
if x >= y:
    cnt = 0
    cnt += y * 2 * c
    cnt += (x - y) * a
    ans = min(ans,cnt)
else:
    cnt = 0
    cnt += x * 2 * c
    cnt += (y - x) * b
    ans = min(ans,cnt)
ans = min(ans, a * x + b * y)
ans = min(ans, max(x,y) * 2 * c)
print(ans)
a,b,c,x,y=map(int,input().split())
ans=712378627461242
for i in range(0,2*max(x,y)+1,2):
    mai=max(0,x-i//2)
    mbi=max(0,y-i//2)
    ans=min(ans,a*mai+b*mbi+c*i)
print(ans)
a, b, c, x, y = [int(w) for w in input().split()]

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

    less = abs(x - y)
    p = a if x > y else b
    if 2 * c < p:
        cnum += 2 * less
        less = 0

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

ans = 10000000000000000000000000000

for i in range(max(x,y)+1):
    price = 2*i*c + max(0,x-i)*a + max(0,y-i)*b
    
    if ans > price:
        ans = price
    
    else:
        continue
print(ans)
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
    print(a*x+b*y)
else:
    print(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)))
a,b,c,x,y = map(int, input().split())
ans=10**10
for i in range(0,max(x,y)*2+1,2):
    sm=c*i
    if x-i/2>0:
        sm+=a*(x-i/2)
    if y-i/2>0:
        sm+=b*(y-i/2)
    ans=min(ans,sm)

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

ans = min(X,Y)*min(2*AB, A+B)
cnt_A = min(X,Y)
cnt_B = min(X,Y)

#残り
if X > cnt_A:#Aが足りないときa
    ans += min(2*AB,A)*(X-cnt_A)
else:#Bが足りないとき
    ans += min(2*AB,B)*(Y-cnt_B)
    
print(ans)
import sys
sys.setrecursionlimit(10000)
def resolve():
    A, B, C, X, Y = list(map(int, input().split(" ")))
    if A + B < 2 * C:
        print(A*X+B*Y)
        return
    if X < Y:
        m = min((Y-X)*B, 2*(Y-X)*C)
        print(2*X*C+m)
        return
    else:
        m = min((X-Y)*A, 2*(X-Y)*C)
        print(2*Y*C+m)
        return

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

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

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

if 2*C<A and 2*C<B:
    ans=C*(2*max(X,Y))
    print(ans)
    exit()

ans=10**10
for i in range(0,2*min(X,Y)+1,2):#ABピザを買う枚数を２枚ずらしで全探索
    tmp = A*(X-0.5*i) + B*(Y-0.5*i) + C*i
    ans=min(ans,tmp)
print(int(ans))
a, b, c, x, y = map(int, input().split())
n = a*x + b*y
sx, rx = divmod(x, 2)
sy, ry = divmod(y, 2)
s = 2*min(sx, sy)
m = 2*c*s + a*(2*sx-s+rx) + b*(2*sy-s+ry)
print(min(n, m))
a, b, c, x, y = (int(each) for each in input().split())

cost = [x*a + y*b]
for i in range(max(x, y)*2):
    numofabpizza = i*2
    numofapizza = max(0, (x-numofabpizza))
    numofbpizza = max(0, (y-numofabpizza))
    # print(numofapizza, numofbpizza, numofabpizza)
    cost.append(numofapizza*a + numofbpizza*b + (2*numofabpizza)*c)
# print(cost)
print(min(cost))
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)) * b) 
else:
    ans = a * x + b * y

print(ans)
A,B,C,X,Y=map(int,input().split())
ans=5000*(10**5)+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)
  ans=min(total,ans)
print(ans)
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())

ans = 10**5
for i in range(10**5):
    tmp = 2*c*i + (x-i)*a + (y-i)*b
    ans = min(ans, tmp)
    if i >= x or i >= y:
        break
print(ans)
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))
a,b,c,x,y = map(int,input().split())
c = c*2
n = max(x,y)
ans = 10**25
for i in range(10**6):
    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())
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*max(X,Y)*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*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*x
print(ans)
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+y*max(0,b-c))
ans.append(c*y+x*max(0,a-c))
print(min(ans))
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
    
if y>0:
  if b<=2*c:
    costs += x*b
  else:
    costs += x*2*c
  
print(costs)
a, b, c, x, y = list(map(int, input().split()))

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

if x>y:
  print(min(2*x*c,2*y*c+(x-y)*a,a*x+b*y))
else:
  print(min(2*y*c,2*x*c+(y-x)*a,a*x+b*y))
A,B,C,X,Y=map(int,input().split())
ans_2=A*X+B*Y
ans=min(X,Y)*2*C
mindelta=10**20
for i in range(1,max(X,Y)+1-min(X,Y)):
    delta=0
    if X>Y:
        delta=2*C*i+A*(max(X,Y)-min(X,Y)-i)
        if delta<mindelta:
            mindelta=delta
    if Y>X:
        delta=2*C*i+B*(max(X,Y)-min(X,Y)-i)
    if delta<mindelta:
        mindelta=delta
val=min([ans+mindelta,ans_2])
print(val)
a,b,c,x,y = map(int,input().split())
if a+b<=2*c:#そのまま買えばいいとき
    print(x*a+y*b)
else:#ABピザを買ったほうが安くなる場合
    if a*x+b*y<2*c*max(x,y):
        cnt=2*c*min(x,y) #ABピザを買えるだけ買う
        if x<y: cnt+=b*(y-x)
        elif x>y: cnt+=a*(x-y)
    else:
        cnt=2*c*max(x,y)
    print(cnt)
##import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b,c,x,y=map(int,input().split())
if x<y:
    ans=min((a*x+b*y),2*x*c+a*(y-x),2*y*c)
    
else:
    ans=min((a*x+b*y),2*y*c+b*(x-y),2*x*c)
print(ans)
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])

    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()))
candi = []
for i in range(100001):
    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())
if min(a, b) >= 2 * c:
    print(c * 2 * max(x, y))
    # print("1")
elif (a + b) / 2 >= c:
    if x >= y:
        print(c * 2 * y + a * (x - y))
        # print("2-1")
    else:
        print(c * 2 * x + b * (y - x))
        # print("2-2")
else:
    print(a * x + b * y)
    # print("3")
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*2 + (x - i//2) * a + (y - i//2) * b)
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = 2*(5000*10**5)
for Z in range(10**5+1):
    total = A*abs(X-Z)+B*abs(Y-Z)+2*C*Z
    ans = min(total,ans)
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = 10**18
Z = max(X, Y)
for i in range(Z+1):
  price = 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=int(5000*(10**5))

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

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

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

for i, j in ((a, x), (b, y)):
    if a // 2 > c:
        ans += j * c * 2
    else:
        ans += i * j

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

if A+B > 2*C:
  if X < Y:
    if 2*C <= B:
      Sum = C * Y
    else:
      Sum = C * X + B * (Y - X)
  elif Y < X:
    if 2*C <= A:
      Sum = C * X
    else:
      Sum = C * Y + A * (X - Y)
  else:
    Sum = C * X

print(Sum)
#関数リスト
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()
    if C >= (A+B) / 2:
        print(A*X+B*Y)
    else:
        temp = min(X,Y)
        print(C*temp*2+(X-temp)*A+(Y-temp)*B)
    
    
if __name__ == "__main__":
    main()
A,B,C,X,Y = map(int,input().split())
X_piza = X
Y_piza = Y
minimum = 10**10
for i in range(0,10**5+2,2):
  if minimum>C*2*i+max(0,X-i)*A+max(0,Y-i)*B:
    minimum = C*2*i+max(0,X-i)*A+max(0,Y-i)*B
print(minimum)
a,b,c,x,y = map(int, input().split())

if c<a/2 and c<b/2:
    print(c*max(x,y)*2)
elif (a+b)/2 < c:
    print(a*x + b*y)
else:
    if x<y:
        print(c*2*x + b*(y-x))
    else:
        print(c*2*y + a*(x-y))