Problem:


Score : 300 points

Problem Statement

"Pizza At", a fast food chain, offers three kinds of pizza: "A-pizza", "B-pizza" and "AB-pizza". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.

Nakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.

Constraints

1 ≤ A, B, C ≤ 5000

1 ≤ X, Y ≤ 10^5

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B C X Y

Output

Print the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.

Sample Input 1

1500 2000 1600 3 2

Sample Output 1

7900

It is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.

Sample Input 2

1500 2000 1900 3 2

Sample Output 2

8500

It is optimal to directly buy three A-pizzas and two B-pizzas.

Sample Input 3

1500 2000 500 90000 100000

Sample Output 3

100000000

It is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.



Sample input:
1500 2000 1600 3 2


Sample output:
7900

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
p_=a*x+b*y
for i in range(10**5):
  p=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  if p<p_:
    p_=p
print(p_)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
p_=float('inf')
for i in range(10**5):
  p=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  if p<p_:
    p_=p
print(p_)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(lambda x: int(x), input().split())
if min(a,b)>2*c: # ABピザのみで済む場合
    print(max(x,y)*2*c)
elif a+b<2*c: # ABピザが不要な場合
    print(a*x+b*y)
elif x>y:
    print(2*y*c+(x-y)*a)
else:
    print(2*x*c+(y-x)*b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
l=[]
l.append(x*a+y*b)
l.append(2*x*c+max(0,y-x)*b)
l.append(2*b*c+max(0,x-y)*a)
print(min(l))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=10000*max(a,b)
for i in range(0,max(x,y)*2+1,2):
    if (x-i//2)>0 and (y-i//2)>0:
        d=i*c+(x-i//2)*a+(y-i//2)*b
    elif (x-i//2)>0 and (y-i//2)<=0 :
        d=i*c+(x-i//2)*a
    elif (x-i//2)<=0 and (y-i//2)>0 :
        d=i*c+(y-i//2)*b
    else:
        d=i*c
    ans=min(ans,d)
print(ans)

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

ans = 0

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

Submission status: Wrong Answer

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

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

q = A*X + B*Y

print(min(p, q))

Submission status: Wrong Answer

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

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

q = A*X + B*Y

print(min(p, q))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=list(map(int,input().split()))
mx=max(x,y)
mn=min(x,y)
print(min(a*x+b*y,c*2*mx,c*2*mn+a*(mx-mn),c*2*mn+b*(mx-mn)))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=list(map(int,input().split()))
mx=max(X,Y)
mn=min(X,Y)
if min(A,B)>C:
	print(mx*2*C)
elif (A+B)/2>=C and X>=Y:
	print((mx-mn)*A+mn*2*C)
elif (A+B)/2>=C and X<Y:
	print((mx-mn)*B+mn*2*C)
elif (A+B)/2<C:
	print(X*A+Y*B)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=list(map(int,input().split()))
mx=max(X,Y)
mn=min(X,Y)
if min(A,B)>=C:
	print(mx*2*C)
elif (A+B)/2>=C and X>=Y:
	print((mx-mn)*A+mn*2*C)
elif (A+B)/2>=C and X<Y:
	print((mx-mn)*B+mn*2*C)
elif (A+B)/2<C:
	print(X*A+Y*B)

Submission status: Wrong Answer

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

box = []

for n in range(0, X*2 if X > Y else Y*2 , 2):
     An = X - n//2
     Bn = Y - n//2
     box.append(A*An + B*Bn + C*n)

print(min(box))

Submission status: Wrong Answer

Solution code:
a, b, c, x , y = map(int, input().split())


mini = 100000

for i in range(max(x,y)+1):
    sum = (2*c*i) + (a *max(0, x-i) + (b * max(0, y-i)))
    if sum <= mini:
        mini = sum

print(mini)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=float('inf')
for A in range(x+1):
  for B in range(y+1):
    p=A*a+B*b+max(x-A,y-B)*c
    if p<ans:
      ans = p
print(ans)

Submission status: Wrong Answer

Solution code:
ip = list(map(int,input().split()))
a = ip[0]
b = ip[1]
c = ip[2]
xy = []
xy.append(ip[3])
xy.append(ip[4])

ans = 0
if a > 2*c and b > 2*c:
	ans = max(xy) * 2*c
else:
	if a > 2*c:
		bb = xy[1] - xy[0]
		cc = 2*xy[0]
		if bb < 0:
			bb = 0
		ans = bb*b + cc*c
	elif b > 2*c:
		aa = xy[0] - xy[1]
		cc = 2*xy[1]
		ans = aa*a + cc*c
	else:
		ans = a*xy[0] + b*xy[1] + c*(a+b)
		for k in range(max(xy)):
			aa = xy[0] - k
			bb = xy[1] - k
			cc = 2*k
			if aa < 0:
				aa = 0
			if bb < 0:
				bb = 0
			tmp = aa*a + bb*b + cc*c
			if tmp < ans:
				ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
ip = list(map(int,input().split()))
a = ip[0]
b = ip[1]
c = ip[2]
xy = []
xy.append(ip[3])
xy.append(ip[4])

ans = 0
if a > 2*c and b > 2*c:
	ans = max(xy) * 2*c
else:
	ans = a*xy[0] + b*xy[1] + c*(a+b)
	for k in range(max(xy)):
		aa = xy[0] - k
		bb = xy[1] - k
		cc = 2*k
		if aa < 0:
			aa = 0
		if bb < 0:
			bb = 0
		tmp = aa*a + bb*b + cc*c
		if tmp < ans:
			ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
ip = list(map(int,input().split()))
a = ip[0]
b = ip[1]
c = ip[2]
xy = []
xy.append(ip[3])
xy.append(ip[4])

ans = 0
if a > 2*c and b > 2*c:
	ans = max(xy) * 2*c
else:
	ans = a*xy[0] + b*xy[1] + c*(a+b)
	for k in range(max(xy)):
		aa = xy[0] - k
		bb = xy[1] - k
		cc = 2*k
		tmp = aa*a + bb*b + cc*c
		if tmp < ans:
			ans = tmp

print(ans)

Submission status: Wrong Answer

Solution code:
"""#################################################################
【ARC096】
C_Half_and_Half
#################################################################"""

#インポート
import sys
from collections import Counter

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))  #リスト(int型)
def MI(): return map(int, sys.stdin.readline().rstrip().split())        #多変数(int型)
def II(): return int(sys.stdin.readline().rstrip())                     # 1変数(int型)
def S(): return sys.stdin.readline().rstrip()                           #文字列(str型)

A, B, C, X, Y = MI()
Nmax = 10 ** 5
min = 10 **8
for i in range(Nmax+1):
    cost = i * 2 * C + max(0, X - i)*A + max(0, Y - i)*B
    if min > cost:
        min = cost
print(min)

Submission status: Wrong Answer

Solution code:
"""#################################################################
【ARC096】
C_Half_and_Half
#################################################################"""

#インポート
import sys
from collections import Counter

#入力用
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))  #リスト(int型)
def MI(): return map(int, sys.stdin.readline().rstrip().split())        #多変数(int型)
def II(): return int(sys.stdin.readline().rstrip())                     # 1変数(int型)
def S(): return sys.stdin.readline().rstrip()                           #文字列(str型)

A, B, C, X, Y = MI()
print(A, B, C, X, Y)
Nmax = 10 ** 5
min = 10 **8
for i in range(Nmax+1):
    cost = i * 2 * C + max(0, X - i)*A + max(0, Y - i)*B
    if min > cost:
        min = cost
print(min)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
if X >= Y:
    more = A
elif X < Y:
    more = B

total = A * X + B * Y

if C * (X + Y) < total:
    if X == Y:
        total = 2 * C * X
    else:
        if C < more:
            total = 2 * C * max(X, Y)
        else:
            total = 2 * C * min(X, Y) + (max(X, Y) - min(X, Y)) * more

print(total)

Submission status: Wrong Answer

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

if C < (A + B) / 2:
    if X == Y:
        total = 2 * C * X
    else:
        if X > Y: more = A
        else:     more = B
        if C < more:
            total = 2 * C * max(X, Y)
        else:
            total = 2 * C * min(X, Y) + (max(X, Y) - min(X, Y)) * more
else:
    total = A * X + B * Y

print(total)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split() )

#print(a,b,c,x,y)

cost = a*x + b*y

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if a+b<y:
	print(max(x,y)*c*2)
elif a+b<c*2:
	print(a*x+b*y)
else:
	d=min(x,y)
	if x<=y:
		print(d*2*c+(y-x)*b)
	else:
		print(d*2*c+(x-y)*a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if 2 * C <= A or 2 * C <= B:
    max_xy = max(X, Y)
    ans = 2 * C * max_xy
elif 2 * C < A + B:
    min_xy = min(X, Y)
    ans = A * (X-min_xy) + B * (Y-min_xy) + 2 * C * min_xy
else:
    ans = A * X + B * Y
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y= map(int,input().split())
d = a+b
sums = 0
if 2*c <= d:
  sums += 2*c*min(x, y)
  #print(sums)
else:
  sums += a*x + b*y
  print(sums)
  exit()
if x > y and 2*c >= a:
  sums += a*(x-y)
  #print(sums)
elif 2*c <= a and 2*c <= b:
  sums += 2*c*abs(x-y)
  #print(sums)
elif x < y and 2*c >= b:
  sums += b*(y-x)
  #print(sums)
print(sums)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y= map(int,input().split())
d = a+b
sums = 0
if 2*c < d:
  sums += 2*c*min(x, y)
else:
  sums += a*x + b*y
  print(sums)
  exit()
if x > y and 2*c > a:
  sums += a*(x-y)
elif 2*c < a and 2*c < b:
  sums += 2*c*abs(x-y)
elif x < y and 2*c > b:
  sums += b*(y-x)
print(sums)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y= map(int,input().split())
d = a+b
sums = 0
if 2*c < d:
  sums += 2*c*min(x, y)
else:
  sums += a*x + b*y
  print(sums)
  exit()
if x > y:
  sums += a*(x-y)
elif 2*c < a and 2*c < b:
  sums += 2*c*abs(x-y)
elif x < y:
  sums += b*(y-x)
print(sums)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y= map(int,input().split())
d = a+b
sums = 0
if 2*c < d:
  sums += 2*c*min(x, y)
else:
  sums += a*x + b*y
  print(sums)
  exit()
if x > y:
  sums += a*(x-y)
elif 2*c < a and 2*c < b:
  sums += 2*c*abs(x-y)
else:
  sums += b*(y-x)
print(sums)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
 
ans_min = x * a + y * b
i = 0
while x - i > 0 or y - i > 0:
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans
    i += 1
print(ans_min)

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
if a + b > ab*2:
  ab1 = True
else:
  ab1 = False

if a > ab*2:
  a1 = True
else:
  a1 = False

if b > ab*2:
  b1 = True
else:
  b1 = False

price = 0
if x > y:
  if ab1 is True:
    price += ab*2*y
    if a1 is True:
  	  price += ab*2*(x-y)
    else:
      price += a*2*(x-y)
  else:
    price += a*x + b*y
else:
  if ab1 is True:
    price += ab*2*x
    if b1 is True:
      price += ab*2*(y-x)
    else:
      price += b*2*(y-x)
  else:
    price += a*x + b*y
    
print(price)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
half_a = a/2
half_b = b/2
more_price = a if x>y else b
more = abs(x-y)
n = min(x,y)
 
if c > half_a +half_b:
  res = a*x + b*y
 
if more_price > c*2:
  add = c*2*more
else:
  add = more_price*more
 
res =  c*2*n + add

print(res)

Submission status: Wrong Answer

Solution code:
A,B,AB,X,Y = map(int,input().split())
A = min(2*AB,A)
B = min(2*AB,B)
if 2*AB < A+B:
    if X>Y:
        print(AB*2*Y + A*(X-Y))
    else:
        print(AB*2*X + A*(Y-X))
else:print(A*X+B*Y)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())

ans_min = x * a + y * b
for i in range(100000):
    ans = i * 2 * c + max(0, x - i) * a + max(0, y - i) * b
    if ans < ans_min:
        ans_min = ans

print(ans_min)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())

count_min = x * a + y * b
for p_a in range(x + 1):
    for p_b in range(y + 1):
        for p_ab in range(max(x, y) * 2 + 1):
            if p_a + 0.5 * p_ab == x and p_b + 0.5 * p_ab == y:
                count = p_a * a + p_b * b + p_ab * c
                if count < count_min:
                    count_min = count
                    print(p_a, p_b, p_ab)

print(count_min)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
min_total = a*x + b*y
for ci in range(max(x,y)*2+1):
  ai = max(0,x - ci//2)
  bi = max(0,y - ci//2)
  
  total = ai*a + bi*b + ci*c
  if min_total > total:
    min_total = total
    if min_total < 100200000:
      print(ai,bi,ci)
print(min_total)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = list(map(int, input().split()))

cost = []
if c <= a and c <= b:
    if x < y:
        cost.append(y*c*2)
    else:
        cost.append(x*c*2)
elif x < y:
    cost.append(c*x*2+(y-x)*b)
else:
    cost.append(c*y*2+(x-y)*a)

cost.append(x*a+y*b)
    
print(min(cost))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
sum1 = a * x + b * y
if x >= y:
    sum2 = c * y * 2 + (x - y) * a
    sum3 = c * x * 2
else:
    sum2 = c * x * 2 + (y - x) * a
    sum3 = c * y * 2
print(min(sum1, sum2, sum3))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
if min(a, b) / 2 > c:
    if x > y:
        sum = c * x * 2
    else:
        sum = c * y * 2
    print(sum)
else:
    # if not use c
    sumWithoutC = a * x + b * 2
    # if use c
    if x > y:
        z = y * 2
        x = x - y
        y = 0
    else:
        z = x * 2
        y = y - x
        x = 0
    sumWithC = a * x + b * y + c * z
    print(min(sumWithoutC, sumWithC))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
cost = a * x + b * y
for i in range(2 * max(x,y) + 1):
        if i % 2 == 0:
                if i / 2 <= x and i / 2 <= y:
                        cost_ = i * c + (x - i/2) * a + (y - i/2) * b
                        if cost_ < cost:
                                cost = cost_
                elif i / 2 <= x and i / 2 > y:
                        cost_ = i * c + (x - i/2) * a
                        if cost_ < cost:
                                cost = cost_
                else:
                        cost_ = i * c + (y - i/2) * b
                        if cost_ < cost:
                                cost = cost_
        else:
                if i / 2 <= x and i / 2 <= y:
                        cost_ = i * c + (x - (i - 1)/2) * a + (y -(i - 1)/2) * b
                        if cost_ < cost:
                                cost = cost_
                elif i / 2 <= x and i / 2 > y:
                        cost_ = i * c + (x - (i - 1)/2) * a
                        if cost_ < cost:
                                cost = cost_
                else:
                        cost_ = i * c + (y - (i - 1)/2) * b
                        if cost_ < cost:
                                cost = cost_
print(cost)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split(' '))

min_price = 10000 * 3 * 5000
for pizza_c in range(max(x, y) * 2 + 1):
        pizza_a = max(x - int(pizza_c / 2), 0)
        pizza_b = max(y - int(pizza_c / 2), 0)
        min_price = min(pizza_a * a + pizza_b * b + pizza_c * c, min_price)
print(min_price)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int,input().split(" ")))

total=0
total2=0
if A+B>2*C:
    total+=2*C*min(X,Y)
    if X>Y:
        total+=(X-Y)*A
    else:
        total+=(Y-X)*B
    total2+=2*C*max(X,Y)
else:
    total = X*A+Y*B
print(min(total,total2))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = list(map(int,input().split()))
c = [X,Y]
total = 0
if A+B >= 2*C:
  total += 2*C*(min(c))
  if X > Y:
    if A >= 2*C:
      total += 2*C*(X-Y)
    else:
      total += A*(X-Y)
  else:
    if A >= 2*C:
      total += 2*C*(Y-X)
    else:
      total += B*(Y-X)
else:
  total += A*X + B*Y

print(total)

Submission status: Wrong Answer

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

separate = A * X + B * Y
middle = X * 2 * C + A * (Y - X) if min(X, Y) == X else Y * 2 * C + A * (X - Y)
whole = max(X, Y) * 2 * C

print(min(separate, middle, whole))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
minimum = max(A, B, C) * 3 * (X + Y)
for c in range(2 * max(X, Y)+1):
    a = int(X - c/2 + 1/2)
    b = int(Y - c/2 + 1/2)
    minimum = min(minimum, a * A + b * B + c * C)
print(minimum)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
result = 0
A_B = a+b
hlf = c*2

if A_B < hlf:  # example 2
    result = a*x + b*y
elif hlf < min(a, b):  # example 3
    result = max(x, y)*hlf
else:  # example 1
    maxi = max(x, y)
    tmp = 0
    if maxi == x:
        tmp = a
    else:
        tmp = b

    if maxi % 2 != 0:
        maxi -= 1
    result = maxi*hlf+tmp

print(result)

Submission status: Wrong Answer

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

cost = 0
if C * 2 < A or C * 2 < B:
    cost += max(X, Y) * C * 2
elif C * 2 < (A + B):
    common = min(X, Y)
    cost += common * C * 2
    if X - common > 0:
        cost += A * (X - common)
    elif Y - common > 0:
        cost += B * (Y - common)
else:
    cost += A * X + B * Y
print(cost)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
A = a*x
B = b*y
AB = c*min(x,y)

if abs(A-B) >= abs(min(A,B)-AB):
    print(A+B)
else:
    fee = AB*2
    if max(x,y)%2 == 0:
        print(fee + c*abs(y-x)*2)
    elif x == y:
        print(fee)
    elif x < y:
        print(fee + b*(y-x))
    else:
        print(fee + a*(x-y))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
A = a*x
B = b*y
AB = c*min(x,y)

if abs(A-B) > abs(min(A,B)-AB):
    print(A+B)
else:
    fee = AB*2
    if max(x,y)%2 == 0:
        print(fee + c*abs(y-x)*2)
    elif x == y:
        print(fee)
    elif x < y:
        print(fee + b*(y-x))
    else:
        print(fee + a*(x-y))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())

A = a*x
B = b*y
AB = c*min(x,y)

if abs(A-B) > abs(min(A,B)-AB):
    print(A+B)
else:
    fee = AB*2
    if max(x,y)%2 == 0:
        print(fee + c*abs(y-x)*2)
    elif x < y:
        print(fee + b*(y-x))
    else:
        print(fee + a*(x-y))

Submission status: Wrong Answer

Solution code:
nyu=input()
nyu=nyu.split()
A=int(nyu[0])
B=int(nyu[1])
C=int(nyu[2])
X=int(nyu[3])
Y=int(nyu[4])
cost=[]
for C_now in range(X+1):
    A_now=max(0,X-C_now)
    B_now=max(0,Y-C_now)
    cost.append(A*A_now+B*B_now+2*C*C_now)
print(min(cost))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int, input().split())
ans=[0]*200001
for i in range(200001):
    if i%2==0:
        ans[i]+=i*c
        if i/2<=x:
            xx=x-i/2
            ans[i]+=xx*a
        if i/2<=y :   
            yy=y-i/2
            ans[i]+=yy*b
an=list(map(int,ans))
aa=list(set(an))
aa.pop(0)
print(min(aa))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split(' '))
ans=-1
for n_ab in range(min(X,Y)+1):
  n_a = max(X-n_ab, 0)
  n_b = max(Y-n_ab, 0)
  p = n_a*A+n_b*B+n_ab*2*C
  ans=p if ans==-1 or p<ans else ans
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,ab,x,y=map(int,input().split())
m=min(x,y)
if a+b >= 2*ab:
  if x <= y:
    print(ab*2*m + (y-x)*b)
  else:
    print(ab*2*m + (x-y)*a)
else:
  print(a*x + b*y)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
print(min(a*x + b*y, 2*c*max(x,y), 2*c*y + a*(x-y) +(10**10 if y > x else 0), 2*c*x + a*abs(y-x)+(10**10 if x > y else 0)))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
print(min(a*x + b*y, 2*c*max(x,y), 2*c*y + a*abs(x-y), 2*c*x + a*abs(y-x)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split(' ')]
if 2*A[2] < A[0] + A[1]:
  m = min(A[3], A[4])
  print(A[2] * m * 2 + (A[3] - m)*min(A[0],2*A[2]) + (A[4] - m)*min(A[0],2*A[2]) )
else:
  print(A[3] * A[0] + A[4] * A[1])

Submission status: Wrong Answer

Solution code:
A = [int(i) for i in input().split(' ')]
if 2*A[2] < A[0] + A[1]:
  m = min(A[3], A[4])
  print(A[2] * m * 2 + (A[3] - m)*A[0] + (A[4] - m)*A[1])
else:
  print(A[3] * A[0] + A[4] * A[1])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys

lst = list(map(int, input().split()))

a_value = lst[0]
b_value = lst[1]
c_value = lst[2]
a_number = lst[3]
b_number = lst[4]

value = 0

if a_value + b_value <= c_value * 2:
    value = a_value * a_number + b_value * b_number
    print (value)
else:
    if a_number >= b_number:
        value += c_value * 2 * b_number
        if (a_number - b_number) * a_value >= (a_number - b_number) * c_value * 2:
            value += (a_number - b_number) * c_value * 2
        else:
            value += (a_number - b_number) * a_value

    else:
        value += c_value * 2 * a_number
        if (b_number - a_number) * b_value >= (b_number - a_number) * c_value * 2:
            value += (b_number - a_number) * c_value * 2
        else:
            value += (b_number - a_number) * a_value
    print (value)

Submission status: Wrong Answer

Solution code:

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


def r(a, b, c, x, y):
    print(a, b, c, x, y)
    if x == 0 and y == 0:
        return 0
    if x == 0:
        return min(y*b, 2*y*c)
    if y == 0:
        return min(x*a, 2*x*c)
    if (a + b) / 2 < c:
        return a*x+b*y
    else:
        z = min(x, y) * 2
        x = x - z/2
        y = y - z/2
        return r(a, b, c, x, y) + z*c


print(int(r(A, B, C, X, Y)))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = list(map(int, input().split()))

# xの方が多い状態にする
if x<y:
    a,b,x,y = b,a,y,x

min_price = 100000000000000000
for i in range(x):
    # 残り枚数がマイナスにならないようにmaxを取る
    need = max(0,(x-i))*a + max(0,(y-i))*b + 2*i*c
    min_price = min(min_price, need)    
print(min_price)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = list(map(int, input().split()))

# xの方が多い状態にする
if x<y:
    a,b,x,y = b,a,y,x

min_price = 1000000000000
for i in range(x):
    # 残り枚数がマイナスにならないようにmaxを取る
    need = max(0,(x-i))*a + max(0,(y-i))*b + 2*i*c
    min_price = min(min_price, need)    
print(min_price)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if x>y:
  ans=a*(x-y)+c*y
else:
  ans=b*(y-x)+c*x
ans=min(ans,a*x+b*y)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
p=5000000000
for i in list(range(0,max([X+1,Y+1]))):
    if p > max([X-i,0])*A+max([Y-i,0])*B+2*C*i:
        p=p
print(p)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
if A+B<= 2*C:
    p = A*X+B*Y
elif min([X,Y])<2*C<A+B:
    if X>Y:
        p=min([X,Y])*2*C+(X-Y)*A
    else:
        p=min([X,Y])*2*C+(Y-X)*A
else:
    p=max([X,Y])*2*C
print(p)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().split(' ')))
ans = A*X + B*Y

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = list(map(int, input().strip().split()))
costmin = 5e9
for i in range(2500):
	cost = 0
	cost += i*C*2
	if X > i:
		cost += A*(X-i)
	if Y > i:
		cost += B*(Y-i)
	if cost < costmin:
		costmin = cost
print(costmin)

Submission status: Wrong Answer

Solution code:
[a,b,c,x,y]=[int(i) for i in input().split()]

ab=c*2
#print(a,b,ab)

min=10**8

for i in range(10**5+1):
    tempx=x
    tempy=y
    abcount=i*2
    price=ab*abcount
    tempx-=abcount
    tempy-=abcount
    if tempx>0:
        price+=tempx*a
    if tempy>0:
        price+=tempy*b

    if min>price:
        min=price
    #if i<10:
     #   print(price,abcount, min, tempx, tempy)

print(min)

Submission status: Wrong Answer

Solution code:
[a,b,c,x,y]=[int(i) for i in input().split()]

ab=c*2
#print(a,b,ab)

min=10**8

for i in range(1000000):
    tempx=x
    tempy=y
    abcount=i*2
    price=ab*abcount
    tempx-=abcount
    tempy-=abcount
    if tempx>0:
        price+=tempx*a
    if tempy>0:
        price+=tempy*b

    if min>price:
        min=price
    #if i<10:
     #   print(price,abcount, min, tempx, tempy)

print(min)

Submission status: Wrong Answer

Solution code:
[a,b,c,x,y]=[int(i) for i in input().split()]

ab=c*2
#print(a,b,ab)

min=10**8

for i in range(5000):
    tempx=x
    tempy=y
    abcount=i*2
    price=ab*abcount
    tempx-=abcount
    tempy-=abcount
    if tempx>0:
        price+=tempx*a
    if tempy>0:
        price+=tempy*b

    if min>price:
        min=price
    #if i<10:
     #   print(price,abcount, min, tempx, tempy)

print(min)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
A, B, C, X, Y = map(int, input().split())
if (A + B) < 2*C:
  print(X*A+Y*B)
  sys.exit()
else:
  if X >= Y:
    C_pr = Y*2*C
    if A <= B:
      pr = (X - Y)*A
    else:
      if A >= 2*C:
        pr = (X - Y)*2*C
      else:
        pr = (X - Y)*A
  else:
    C_pr = X*2*C
    if A >= B:
      pr = (Y - X)*B
    else:
      if B >= 2*C:
        pr = (Y - X)*2*C
      else:
        pr = (Y - X)*B
print(C_pr + pr)

Submission status: Wrong Answer

Solution code:
import sys
A, B, C, X, Y = map(int, input().split())
if (A + B) <= 2*C:
  print(X*A+Y*B)
  sys.exit()
else:
  if X >= Y:
    C_pr = Y*2*C
    if A <= B:
      pr = (X - Y)*A
    else:
      if A >= 2*C:
        pr = (X - Y)*2*C
      else:
        pr = (X - Y)*A
  else:
    C_pr = X*2*C
    if A >= B:
      pr = (Y - X)*B
    else:
      if B >= 2*C:
        pr = (Y - X)*2*C
      else:
        pr = (Y - X)*B
print(C_pr + pr)