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())
ans = X*A + Y*B
for i in range(max(X,Y)+1):
    C = 2*C*i + max(0,X-i)*A + max(0,Y-i)*B
    ans = min(ans, C)
print(ans)

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:
    c*2*min(x,y)+min(max(a*min(x,y),b*min(x,y)),c*2*abs(x-y))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

piza_min = min(x,y)

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

print(min(plan1,plan2))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=998244353
from collections import deque
########################################################
a,b,c,x,y=INPUT()
#cost of 1 pi is a+b or 2*c
if 2*c<(x+y):
    cost=2*c*min(x,y)
    if x>y:
        r=x-y
        if 2*c>x:
            cost+=r*a
        else:
            cost+=r*(2*c)
        print(cost)
    else:
        r=y-x
        if 2*c>y:
            cost+=r*b
        else:
            cost+=r*(2*c)
        print(cost)
else:
    print(x*a+y*b)

Submission status: Wrong Answer

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

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)
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)

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

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

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

Submission status: Wrong Answer

Solution code:
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))

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

if (c > a and c > b):
    total = a * x + b * y
elif (c < a and c < b):
    total = c * 2 * max(x,y)
else:
    for i in range(0,x+1):
        for j in range(0,y+1):
            k = 2 * max(x-i,y-j)
            if first > k:
                first = k
                target = a * i + b * j + c * k
                if total > target:
                        total = target
                else:
                    continue
            else:
                continue
        else:
            continue
    
print(total)

Submission status: Wrong Answer

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

result=[]
if (a <= c <= b) or (b <= c <= a):
    if a > b :
        for i in range(2 * max(x,y),-1,-2):
            for j in range(0,x+1):
                if j + i // 2 == x:
                    # print('first')
                    # print(i,j)
                    if y > i // 2:
                        b_num = y - i // 2
                        result.append(a * ( x - i // 2 ) + b * b_num + c * i)
                    else:
                        b_num = i // 2
                        result.append(a * ( x - i // 2 ) + b * b_num + c * i)
                else:
                    continue
    else:
        for i in range(2 * max(x,y),-1,-2):
            for j in range(0,y+1):
                if j + i // 2 == y:
                    # print('second')
                    # print(i,j)
                    if x > i // 2:
                        a_num = x - i // 2
                        result.append(a * a_num + b * ( y - i // 2 ) + c * i)
                    else:
                        a_num = i // 2
                        result.append(a * a_num + b * ( y - i // 2 ) + c * i)
                else:
                    continue
elif(c > a and c > b):
    result.append(a * x + b * y)
else:
    result.append(c * 2 * max(x,y))
    
            
print(min(result))

Submission status: Wrong Answer

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

a_num = 0
b_num = 0
c_num = 2 * max(x,y)+1
total = 5000 * 10 ** 5 * 2


for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if not(a_num == i and c_num == k):
            if not(b_num == j and c_num ==k):
                a_num = i
                b_num = j
                c_num = k
                target = a * i + b * j + c * k
                if total > target:
                    total = target
                else:
                    break
            else:
                break
        else:
            break
print(total)

Submission status: Wrong Answer

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

a_num = 0
b_num = 0
c_num = 2 * max(x,y)+1
total = 5000 * 10 ** 5 * 2


for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if a_num == i and c_num == k:
            break
        else:
            a_num = i
            c_num = k
            target = a * i + b * j + c * k
            if total > target:
                total = target
            else:
                break
print(total)

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

if a < b :
    cheep = y + 1
    expensive = x + 1
else:
    cheep = x + 1
    expensive = y + 1
    a,b = b,a


for i in range(0,cheep):
    for j in range(0,expensive):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                break
        else:
            break
    
print(total)

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

if a < b :
    cheep = x + 1
    expensive = y + 1
else:
    cheep = y + 1
    expensive = x + 1
    a,b = b,a


for i in range(0,cheep):
    for j in range(0,expensive):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                break
        else:
            break
    
print(total)

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                continue
        else:
            break
    
print(total)

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                continue
        else:
            break
    else:
        continue
    
print(total)

Submission status: Wrong Answer

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                break
        else:
            break
    else:
        break
    
print(total)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:



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

price = a * x + b * y


for i in range(1, max(a,b) + 1):
    ab = 2 * i
    cand = ab * c + a * max(0, x - i) + b * max(0, y-i)

    price = min(price, cand)

print(price)

Submission status: Wrong Answer

Solution code:



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

price = a * x + b * y


for i in range(max(a,b) + 1):
    ab = 2 * i
    cand = ab * c + a * max(0, x - i) + b * max(0, y-i)

    price = min(price, cand)

print(price)

Submission status: Wrong Answer

Solution code:


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

if x > y:
  d = x
else:
  d = y

#print(d)

for i in range(x + 1):
    for j in range(y + 1):
        for k in range(2 * d + 1):
            if (i + k / 2 >= x and j + k / 2 >= y):
                price = a * i + b * j + c * k
                maxprice = a * x + b * y
                if price <= maxprice:
                    maxprice = price



#print(p_lists)
print(price)

Submission status: Wrong Answer

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

if sum_2 < sum_1:
    print(sum_2)
else:
    print(sum_1)

Submission status: Wrong Answer

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

if sum_2 < sum_1:
    print(sum_2)
else:
    print(sum_1)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int,input().split())
ans = float('inf')
for i in range(max(X,Y)):
  num = i*C + min(0, X-i)*A + min(0, Y-i)*B
  ans = min(ans, num)
print(ans)

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

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:
  if X>=Y:
    print(Y*C + (X-Y)*A)
  else:
    print(X*C + (Y-X)*B)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - int(k/2))
  j = max(0, Y - int(k/2))
  ans = min(ans, A*i + B*j + C*k)
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - k/2)
  j = max(0, Y - k/2)
  ans = min(ans, A*i + B*j + C*k)
print(ans)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(2*max(X, Y)+1, 2):
  i = max(0, X - 2*k)
  j = max(0, Y - 2*k)
  ans = min(ans, A*i + B*j + C*k)
print(ans)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = 0
for i in range(X):
  for j in range(Y):
    for k in range(X+Y, 2):
      if i+k/2==X and j+k/2==Y:
        ans = min(ans, A*i+B*j+C*k)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)):
    m = 0
    m += (a*(x-i))+(b*(y-i))+(c*i)
    ans = min(ans,m)
print(ans)

Submission status: Wrong Answer

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

ans = float("inf")

if X > Y:
    ab = 2 * X
    while ab > 0:
        a = X - (ab / 2)
        if ab / 2 < Y:
            b = int(Y - 2 * ab)
        else:
            b = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
else:
    ab = 2 * Y
    while ab > 0:
        b = Y - (ab / 2)
        if ab / 2 < X:
            a = int(X - 2 * ab)
        else:
            a = 0
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
print(int(ans))

Submission status: Wrong Answer

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

ans = float("inf")

if X > Y:
    a = 0
    b = 0
    ab = 2 * X
    while ab > 0:
        a += X - (ab / 2)
        if ab / 2 < Y:
            b = int(Y - 2 * ab)
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
else:
    a = 0
    b = 0
    ab = 2 * Y
    while ab > 0:
        b += Y - (ab / 2)
        if ab / 2 < X:
            a = int(X - 2 * ab)
        money = a * A + b * B + ab * C
        ans = min(ans, money)
        ab -= 2
print(int(ans))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
if 2*C <= A+B:
  price= 2*C
else:
  price = A+B
maxN = max(X,Y)
miniN = min(X,Y)
res = miniN * price
residue = maxN - miniN
if residue == 0:
  print(res)
elif X > Y:
  res+= min(residue*A, residue*2*C)
  print(res)
elif Y < X:
  res +=  min(residue*B, residue*2*C)
  print(res)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
ans = 7000000000
for i in range(10001):
  amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b
  if ans > amount:
    ans = amount
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
ans = 700000000
for i in range(10001):
  amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b
  if ans > amount:
    ans = amount
print(ans)

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b,c,x,y = i2()
if a+b > 2*c:
	z = min(x,y)//2
	print( a*(x-2*z)+b*(y-2*z)+c*4*z)
else:
	print( a*x+b*y )

Submission status: Wrong Answer

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)==x)*a)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#W, H, x, y, r = map(int, input().split())
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a == c and b == c :
        min_sum = a * x + b * y
    elif a  < c and b < c  or a  == c and b  < c or a < c and b  == c :
        min_sum = a * x + b * y
    elif a  > c and b  > c or a  == c and b  > c or a  > c and b  == c  :
        if x >= y :
            min_sum = y * 2 * c
            if a > c * 2:
                min_sum = min_sum + (x - y) * c * 2
            else:
                min_sum = min_sum + (x - y ) * a
        else:
            min_sum = x * 2 * c
            if b > c * 2:
                min_sum = min_sum + (y - x) * c * 2
            else:
                min_sum = min_sum + (y - x ) * b
    elif a < c and b > c:
        if c - a > b - c : #むだ
            min_sum = a * x + b * y
        else:
            if x >= y :
                min_sum = (x-y)* a + y * c * 2
            else:
                min_sum = (y-x)* b + x * c * 2


    elif a > c and b < c:
        if a - c > c - b : #むだ
            min_sum = a * x + b * y
        else:
            if x >= y :
                min_sum = (x-y)* a + y * c * 2
            else:
                min_sum = (y-x)* b + x * c * 2


    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                if min_sum > a * i + b * j + max(x-i, y-j) * c * 2:
                    min_sum =a * i + b * j + max(x-i, y-j) * c * 2

    print(min_sum)
main()
# if a >= c and b <= c :
#     sum = x * c * 2
#     if x <= y :
#         sum = sum + ( y - x ) * b
# else:
#     sum = y * c * 2
#     if x >= y :
#         sum = sum + ( x - y ) * a


# if b > c * 2 :
    #     b_price = c
    #
    # input_array_list = []
    #
    # while True:
    #     input_array = input().split()
    #     if input_array[0] == "0" and input_array[1] == "0":
    #         break
    #     else:
    #         input_array_list.append(input_array)
    #
    # for item in input_array_list:
    #     n = int(item[0])
    #     k_sum = int(item[1])
    #
    #     count = 0
    #     for i in range(1,n + 1- 2):
    #         for j in range(i+1, n + 1 - 1):
    #             for k in range (j+1, n+ 1):
    #                 if i + j + k == k_sum :
    #                     count = count + 1
    #     print(count)

    #
    # for item in input_array_list:
    #     if item[1] == "+":
    #         print(str(int(item[0])+int(item[2])))
    #     elif item[1] =="-":
    #         print(str(int(item[0])-int(item[2])))
    #     elif item[1] == "/":
    #         print(str(int(item[0])//int(item[2])))
    #     elif item[1] == "*":
    #         print(str(int(item[0])*int(item[2])))
    #

# import sympy as sp

# input_list = []
# a,b,c = map(int, input().split())
# divisors = sp.divisors(c)
#
# count = 0
#
# for divisor in divisors:
#     if a <= divisor and divisor <= b:
#         count = count + 1
# print(count)
#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)
#
# for pair_int in input_list:
#     if pair_int[0] <= pair_int[1]:
#         print("{} {}".format(pair_int[0], pair_int[1]))
#     else:
#         print("{} {}".format(pair_int[1], pair_int[0]))

#for i in range(10000):
#    print("Hello World")
#a = input().split()
#a_int = [int(s) for s in a]
#a_sorted = sorted(a_int)
#print(' '.join(map(str, a_sorted)))

Submission status: Wrong Answer

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

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a == c and b == c :
        min_sum = a * x + b * y
    if a  < c and b < c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                
                if min_sum > a * i + b * j + max(x-i, y-j) * c * 2:
                    min_sum =a * i + b * j + max(x-i, y-j) * c * 2

    print(min_sum)
main()

Submission status: Wrong Answer

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

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a == c and b == c :
        min_sum = a * x + b * y
    if a  < c and b < c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1, 2):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
                        break
    print(min_sum)
main()

Submission status: Wrong Answer

Solution code:
#W, H, x, y, r = map(int, input().split())
def main():
    a, b, c, x, y = map(int, input().split())

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a == c and b == c :
        min_sum = a * x + b * y
    if a  < c and b < c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1, 2):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
                        else:
                            break
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()

    # if b > c * 2 :
    #     b_price = c
    #
    # input_array_list = []
    #
    # while True:
    #     input_array = input().split()
    #     if input_array[0] == "0" and input_array[1] == "0":
    #         break
    #     else:
    #         input_array_list.append(input_array)
    #
    # for item in input_array_list:
    #     n = int(item[0])
    #     k_sum = int(item[1])
    #
    #     count = 0
    #     for i in range(1,n + 1- 2):
    #         for j in range(i+1, n + 1 - 1):
    #             for k in range (j+1, n+ 1):
    #                 if i + j + k == k_sum :
    #                     count = count + 1
    #     print(count)

    #
    # for item in input_array_list:
    #     if item[1] == "+":
    #         print(str(int(item[0])+int(item[2])))
    #     elif item[1] =="-":
    #         print(str(int(item[0])-int(item[2])))
    #     elif item[1] == "/":
    #         print(str(int(item[0])//int(item[2])))
    #     elif item[1] == "*":
    #         print(str(int(item[0])*int(item[2])))
    #

# import sympy as sp

# input_list = []
# a,b,c = map(int, input().split())
# divisors = sp.divisors(c)
#
# count = 0
#
# for divisor in divisors:
#     if a <= divisor and divisor <= b:
#         count = count + 1
# print(count)
#
# while True:
#     pair_str = input().split()
#     pair_int = [int(s) for s in pair_str]
#     if pair_int[0] == 0 and pair_int[1] == 0 :
#         break
#     else:
#         input_list.append(pair_int)
#
# for pair_int in input_list:
#     if pair_int[0] <= pair_int[1]:
#         print("{} {}".format(pair_int[0], pair_int[1]))
#     else:
#         print("{} {}".format(pair_int[1], pair_int[0]))

#for i in range(10000):
#    print("Hello World")
#a = input().split()
#a_int = [int(s) for s in a]
#a_sorted = sorted(a_int)
#print(' '.join(map(str, a_sorted)))

Submission status: Wrong Answer

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

    min_sum = 100000 * 5000 + 100000 * 5000 + 200000 * 5000

    if a  <= c and b <= c  :
        min_sum = a * x + b * y
    elif a  > c and b  > c  :
        if x >= y :
            min_sum = x * 2 * c
        else:
            min_sum = y * 2 * c
    else:
        for i in range(0, x+1):
            for j in range(0, y+1):
                for k in range(0, max(x,j)*2 + 1, 2):
                    if i + k/2 >= x and j + k / 2 >= y:
                        sum = a * i + b * j + k * c
                        if sum < min_sum:
                            min_sum = sum
                        else:
                            break
    print(min_sum)
        # if a >= c and b <= c :
        #     sum = x * c * 2
        #     if x <= y :
        #         sum = sum + ( y - x ) * b
        # else:
        #     sum = y * c * 2
        #     if x >= y :
        #         sum = sum + ( x - y ) * a

main()