peterverebics/CodeNet_Python_118 huggingface dataset:
# ABC095C

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

if A > C and B > C:
    print(C*max(X, Y))

else:
    if C <= A + B:
        if X > Y:
            print(Y * C + abs(X-Y) * A)

        else:
            print(X * C + abs(X-Y) * B)

    else:
        print(X*A+Y*B)
def main():
    a, b, c, x, y = map(int, input().split())

    ans = 0

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

    print(ans)

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

"""
ABピザの購入数(0~(X+Y)で全探索)
"""
min_price = 10 ** 10
for i in range((X+Y)+1):
    c_price = C * i
    a_price = A * (X - i//2)
    b_price = B * (Y - i//2)
    min_price = min(min_price, a_price+b_price+c_price)
print(min_price)
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
res = A*X + B*Y

sum = C * 2* min_

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 = list(map(int, input().split()))

ans = A*X + B*Y
c = min(X, Y)
ans = min(A*(X-c) + B*(Y-c) + c*C*2, ans)

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

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

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

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

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

    print(ans)

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

m = 10^10
for i in range(X):
  for j in range(Y):
    k = min(2*X-i,2*Y-j)
    m = min(m,A*i+B*j+C*k)
    
print(m)
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)
A,B,C,X,Y = map(int,input().split())
cnt_A = X
cnt_B = Y
cnt_C = 0
ans = []
for _ in range(X+Y):
    if 2*C<=A+B:
        cnt_C += 2
        cnt_A -= 1
        cnt_B -= 1
    ans.append(cnt_A*A+cnt_B*B+cnt_C*C)
    if ((cnt_A<0) or (cnt_B<0)) or ((cnt_C==2*X)or(cnt_C ==Y*22)):
        break  
ans.sort()
print(ans[0])
a, b, c, x, y = map(int, input().split())

ans = 0

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

print(ans)
a, b, c, x, y = [int(i) for i in input().split()]
print((2 * c * min(x, y) + min(a * (x - y), 2 * c * (x - y)) if x > y else min(b * (y - x), 2 * c * (y - x))) if a + b > c * 2 else a * x + b * y)
A,B,C,X,Y=map(int,input().split())

A=10**9
for i in range(0,10**5+1):
    S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B
    A=min(A,S)
print(A)
A,B,C,X,Y = map(int,input().split())
if A + B >= C * 2:
    price = min(X,Y) * C * 2
    X = X - min(X,Y)
    Y = Y - min(X,Y)
    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=[int(i)  for i in input().split()]
ans=1000000000
for k in range(10**5):
	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())

m = 10^10
for i in range(X):
  for j in range(Y):
    k = max(2*X-i,2*Y-j)
    m = min(m,A*i+B*j+C*k)
    
print(m)
a,b,c,x,y=list(map(int,input().split()))

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

# 通常のケース
ans1 = A * X + B * Y

# 半分のケース
if X >= Y:
    ans2 = Y * 2 * C + (X - Y) * A
    ans3 = X * 2 * C
else:
    ans2 = X * 2 * C + (Y - X) * A
    ans3 = Y * 2 * C

print(min(ans1,ans2,ans3))
a, b, c, x, y = map(int, input().split())
p = c * 2 * max(x, y)
q = c * 2 * y + a * (x - y)
r = c * 2 * x + b * (y - x)
s = a * x + b * y
print(min(p, q, r, s))
a,b,c,x,y=map(int,input().split())

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

#print(A,B,C,X,Y)

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

print(ans)
a,b,c,x,y = map(int, input().split())
kei = 0
if c >= a//2 + b//2:
    kei = a * x + b*y

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

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


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

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 - 2 * x, 0))
elif 2 * c <= max(a, b) and b == max(a, b):
    print(c * 2 * y + a * max(x - 2 * 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)
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)
def main():
    a, b, c, x, y = map(int, input().split())

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()
A,B,C,X,Y=map(int,input().split())
ans=0
if A+B>=2*C:
    ans+=min(X,Y)*2*C
    if X>Y:
        ans+=A*(X-Y)
    if Y>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:
  if X>Y:
    print(A*abs(X-Y)+ min(X,Y)*C*2)
  else:
    print(B*abs(X-Y)+ min(X,Y)*C*2)
else:
  print(A*X+B*Y)
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*2*x+a*max(0,y-x))
ans.append(c*2*y+b*max(0,x-y))
print(min(ans))
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 += (max(x,y) - min(x,y)) * a
        else:
            ans += (max(x,y) - min(x,y)) * b
else:
    ans = a * x + b * y

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

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

    print(ans)

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

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

else:
    C_num = min(X, Y)
    print(min(2*C*max(X, Y), C_num*2*C + A*(X-C_num + B*(Y-C_num))))
class Pizza:
  def __init__(self, price, count = 0):
    self.price = price
    self.count = count
    
  def count_pay(self):
  	return self.price * self.count
  
  def add_count(self,n):
  	self.count += n
    
A, B, C, X, Y = map(int, input().split())
P_A = Pizza(A,X)
P_B = Pizza(B,Y)
P_AB = Pizza(C)

i = 0
pay_list = []
while i < max(X, Y):
  pay = P_A.count_pay() + P_B.count_pay() + P_AB.count_pay()
  pay_list.append(pay)
  P_A.add_count(-1)
  P_B.add_count(-1)
  P_AB.add_count(2)
  i += 1

print(min(pay_list))
a,b,c,x,y = map(int, input().split())
if (a + b <= 2*c):
    print(a*x + b*y)
elif a > 2*c and b > 2*c:
    print(max(x,y)*2*c)
elif a > 2*c:
    if x >= y:
        print(x*2*c)
    else:
        print(x*2*c + (y-x)*b)
elif b > 2*c:
    if y >= x:
        print(y*2*c)
    else:
        print(y*2*c  + (x - y)*b)
else:
    tmp = min(x,y)
    print(tmp*2*c + a*(x-tmp) + b*(y-tmp))
A,B,C,X,Y=map(int,input().split())
cost=A*X+B*Y
Z=min(X,Y)
for i in range(0,2*Z+1,2):
    cost=min(cost,C*i+A*(X-(i//2))+B*(Y-(i//2)))
print(cost)
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B < 2*C:
    print(A*X + B*Y)
  elif 2*C <= A and 2*C <= B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A,B,C,X,Y = map(int,readline().split())
AB = 2*max(X,Y)
price = float('inf')
for i in range(0,AB,2):
  total = A * max(0,X-i//2)+ B * max(0,Y-i//2) + C * i 
  price = min(price,total)
print(price)
import math 
import bisect
import heapq
from collections import deque

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

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

for n in range(0, max(x, y) * 2 + 2, 2):
    p = n * c * 2
    nx = max(0, x - n)
    ny = max(0, y - n)
    p += nx * a + ny * b
    ans.append(p)

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

max_XY = max(X, Y)
min_XY = min(X, Y)
ans = float("inf")
for a in range(0, max_XY+1):
    ab = (max_XY - a) * 2
    if min_XY - ab / 2 > 0:
        b = int(min_XY - ab / 2)
    else:
        b = 0
    money = a * A + b * B + ab * C
    ans = min(ans, money)
print(ans)
a, b, c, x, y = map(int, input().split())

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

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

elif A > 2 * C or B > 2 * C:
    print(2*C*max(X, Y))

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

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

if x==y:
    each = 0
elif x>y:
    each = a*(x-y)
else:
    each = b*(y-x)

print(min(x, y)*2*c+each)
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)
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B <= 2*C:
    print(A*X + B*Y)
  elif 2*C < A and 2*C < B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()
a,b,c,x,y=map(int,input().split())
ans=[]
ans.append(a*x+b*y)
ans.append(c*x+b*max(0,y-x))
ans.append(c*y+a*max(0,x-y))
print(min(ans))
def halfandhalf(A,B,C,X,Y):
    if X >= Y:
        if A+B > 2*C:
            sum = C*2*Y + A*(X-Y)
        else:
            sum = A*X + B*Y
        
    else:
        if A+B > 2*C:
            sum = C*2*X + B*(Y-X)
        else:
            sum = A*X + B*Y
    return sum




if __name__ == "__main__":
    A,B,C,X,Y = map(int, input().split())
    print(halfandhalf(A,B,C,X,Y))
a, b, c, x, y = 1500, 2000, 1600, 3, 2
#na, nb, nc = x, y, 0
mx = 10**18
for i in range(0, (x+y+1)):
  if i%2==1: continue
  total = a*(x-i//2) + b*(y-i//2) + c*i
  if total<mx:
    mx=total

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

fee = 0

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

print(fee)
import math
A,B,C,x,y=map(int,input().split())
price=5000*(10**5)
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())
if 2*c < a+b:
    if 2*c < min(x,y):
        print(2*c*max(x,y))
    else:
        if x>=y:
            print(2*c*y+a*(x-y))
        else:
            print(2*c*x+b*(y-x))
else:
    print(a*x+b*y)
a,b,c,x,y=map(int,input().split())
if a+b<=2*c:
  print(a*x+b*y)
elif x>=y:
  print(min(y*2*c+(x-y)*a,x*2*c))
else:
  print(min(x*2*c+(y-x)*a,y*2*c))
A, B, C, X, Y = map(int, input().split())
total = 0
ans = 10**10

for i in range(0, max(X, Y)*2, 2):
  total = A*(X-(i/2)) + B*(Y-(i/2)) + C*i
  print(total)
  ans = min(ans, total)
  
print(int(ans))
A,B,C,X,Y = map(int,input().split())

plan_P = A*X + B+Y

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

if (A + B) <= 2 * C:
  print(plan_P)
else:
  print(plan_Q)
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)
else:
    ans = min(ans, (Y - X) * A + 2 * C * X)

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

s1 = a*x + b*y
s2 = c*(max(x,y)*2)
if x>y:
    s3 = c*(y*2) + a*(x-y)
elif y>x:
    s3 = c*(x*2) + b*(y-x)
else: s3 = 10**10

print(s1,s2,s3)
print(min(s1,s2,s3))
A, B, C, X, Y = map(int, input().split())
result = []
if X >= Y:
    result.append(X * C * 2)
    result.append(Y * C * 2 + (X-Y)*A)
else:
    result.append(Y * C * 2)
    result.append(X * C * 2 + (Y-X)*A)
result.append(X*A+Y*B)
print(min(result))
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
    print(ab_cnt*2*c + remain_a*a + remain_b*b)
a, b, c, x, y = map(int, input().split())
ans = float('inf')
for i in range(1, 100001):
    ans = min(ans, c * 2 * i + max(x - i, 0) * a + max(y - i, 0) * b)
print(ans)
a, b, c, x, y = map(int, input().split())
if x > y:
    cost = min(a*x + b*y, x*c*2, y*c*2 + (x-y)*a)
else:
    cost = min(a*x + b*y, y*c*2, x*c*2 + (y-x)*a)
    
print(cost)
A,B,C,X,Y = map(int,input().split())
l = []
for c in range(0,max(2*X,2*Y)+1,2):
    l.append(A*(X-c/2) + B*(Y-c/2) + C*c)
print(int(min(l)))
a,b,c,x,y=map(int,input().split())
normal=a*x+b*y
half=c*2*min(x,y)+max(a*(x-y),b*(y-x))
print(min(half,normal))
#095_C
a, b, c, x, y = map(int, input().split())

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

ans=[]

ans.append(A*X+B*Y)
ans.append(C*max(X,Y)*2)

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

print(min(ans))
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
y -= x
ret += min(2 * c, b) * y
print(ret)
A, B, C, X, Y = map(int, input().split())

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

else:
    if A*X + B*Y > 2*C*max(X, Y):
        print(2*C*max(X, Y))

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

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

print(count)
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 > c or b > c:
    if c > (a+b) // 2:
        print(a*x + b*y)
    else:
        if x > y:
            print(c * y * 2 + a * (x - y))
        else:
            print(c * x * 2 + b * (y - x))
else:
    print(a*x + b*y)
#C
a, b, c, x, y = map(int,input().split())
ans = 0
if a + b <= 2*c:
    print(a*x + b*y)
else:
    ans += min(x,y) * 2*c
    r = max(x,y) - min(x,y)
    if max(x,y) == x:
        if a <= 2*c:
            ans += a*r
        else:
            ans += 2*c*r
    else:
        if b <= 2*c:
            ans += c*r
        else:
            ans += 2*c*r
    print(ans)
a,b,c,x,y=map(int, input().split())
if x>y:
  print(min(a*x+b*y,2*c*y+a*(x-y),2*c*x))
else:
  print(min(a*x+b*y,2*c*y+b*(y-x),2*c*y))
def main():
    a, b, c, x, y = map(int, input().split())

    total_min = a * x + b * y

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

if __name__ == "__main__":
    main()
a,b,c,x,y=map(int,input().split())
c=c*2
if c<=min(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 = map(int, input().split())
ans = 1e1000
for i in range(X):
  for j in range(Y):
    for k in range(0, X+Y, 2):
      if i+k/2==X and j+k/2==Y:
        ans = min(ans, A*i+B*j+C*k)
print(ans)
import numpy as np
a,b,c,x,y = map(int,input().split())
ans = min(a+b,c*2)*min(x,y)
if c*2 <= min(a,b):
    ans +=c*2*np.abs(x-y)
elif x > y:
    ans += a*(x-y)
else:
    ans += b*(y-x)
print(ans)
a,b,c,x,y=map(int,input().split())
cost=[]
cm=0
while cm<=max(x,y):
    am=x-cm//2    
    bm=y-cm//2
    if am>=0 and bm>=0:
        cost.append(am*a+bm*b+cm*c)
    cm+=2
print(min(cost))
# 2020/04/23
# AtCoder Beginner Contest 095 - C

# Input
a, b, c, x, y = map(int,input().split())

# Calc
case1 = a * x + b * y
case2 = x * 2 * c + max(0, (x * 2 - y) * b)
case3 = max(0, (y * 2 - x) * a) +  y * 2 * c
case4 = max(x, y) * 2 * c

ans = min(case1, case2, case3, case4)

# Output
print(ans)
a,b,c,x,y = map(int,input().split())
c = c*2
n = max(x,y)
ans = 10**25
for i in range(10**5):
    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,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)
if (a+b)//2>=ab:
    if min(a,b)>ab:
        ans+=max(x,y)*2*ab
    else:
        ans+=abcnt*2*ab
        if x>y:
            ans+=(x-abcnt)*a
        else:
            ans+=(y-abcnt)*b
else:
    ans+=x*a+y*b
print(ans)
a,b,c,x,y=map(int,input().split())
sum=0
tmp=min(x,y)
if a+b>=2*c:
  sum+=2*c*tmp
  x-=tmp
  y-=tmp
  print(x)
  print(y)
  if x==0:
    if b>=2*c:
      sum+=2*c*y
    else:
      sum+=b*y
  elif y==0:
    if a>=2*c:
      sum+=2*c*x
    else:
      sum+=a*x
else:
  sum+=a*x+b*y
print(sum)
A, B, C, X, Y = map(int,input().split())

m = 10^10
for i in range(X+1):
  for j in range(Y+1):
    k = min(2*X-i,2*Y-j)
    m = min(m,A*i+B*j+C*k)
    
print(m)
a,b,c,x,y=map(int,input().split())
case=[]
case.append(a*x+b*y)
if x>=y:
    case.append(c*x*2)
    case.append(((x-y)*a)+(c*y*2))
else:
    case.append(y*c*2)
    case.append(((y-x)*a)+(c*x*2))
print(min(case))
a, b, c, x, y = map(int, input().split())
if c < (a + b) / 2:
    if c < a and c < 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())
ans1 = a * x + b * y  #そのまま
if x > y:  #少ない方をABで補う
    ans2 = c * min(x, y) * 2 + a * (x - y)
else:
    ans2 = c * min(x, y) * 2 + b * (y - x)
ans3 = c * max(a, b) * 2  #すべてABで
print(min(ans1, ans2, ans3))
A,B,C,X,Y=map(int,input().split())
Xo=A*X+B*Y
if X>=Y:
 X1=A*(X-Y)+2*C*Y
else:
 X1=B*(Y-X)+2*C*Y
X2=2*C*max(X,Y)
print(min(Xo,X1,X2))