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 = float('inf')
for i in range(max(x,y)):
    tmp = c*2*i + max(0, x-i) * a + max(0, y-i) * b
    ans = min(ans, tmp)

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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 += min(c*s*2 + a*(x-s) + b*(y-s), c*max(x, y)*2)
print(ans)

Submission status: Wrong Answer

Solution code:
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 += min(c*s*2 + min(a, b)*(max(x, y) - s), c*max(x, y)*2)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
min = x if x<y else y
price=0
if a+b > 2*c:
    price = min*2*c
    if a < c*2 and a<b:
        price+=a*(x-y)
    elif b<c*2 and b<a:
        price+=b*(y-x)
    else:
        price+=2*c*(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())
ans = 10**18
for i in range(0,10**5+1,2):
    temp = 2*i*c + max(0,x-i)*a + max(0,y-i)*b
    ans = min(ans,temp)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
sum=0
if a+b>=2*c:
  sum+=2*c*min(x,y)
  x-=min(x,y)
  y-=min(x,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)

Submission status: Wrong Answer

Solution code:
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=min(2*C*i+A*(max(X,Y)-min(X,Y)-i),2*C*(max(X,Y)-min(X,Y)-i)+A*i)
        if delta<mindelta:
            mindelta=delta
    if Y>X:
        delta=min(2*C*i+B*(max(X,Y)-min(X,Y)-i),2*C*(max(X,Y)-min(X,Y)-i)+B*i)
        if delta<mindelta:
            mindelta=delta
val=min([ans+mindelta,ans_2])
print(val)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A, B, C, An, Bn = list(map(int, input().split()))
ABh = (A+B)//2
abx = 0
pay = 0
if ABh > C and not min(A, B)>C*2:
    abx = min(An, Bn)
    pay = abx*C*2
    if An-abx>0:
        pay += (An-abx)*A
    elif Bn-abx>0:
        pay += (Bn-abx)*B
elif ABh <= C:
    pay = A*An+B*Bn

else:
    pay = C*max(An, Bn)*2
    
print(pay)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

cnt_A = max(X, Y)
cnt_B = max(X, Y)

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

for i in range(0, max(X, Y) + 2, 2):
    acc = ans - C * i
    cnt_A -= i // 2
    cnt_B -= i // 2
    if cnt_A < X:
        acc += A * (X - cnt_A)
        cnt_A = X
    if cnt_B < Y:
        acc += B * (Y - cnt_B)
        cnt_B = Y
    ans = min(ans, acc)

print(ans)

Submission status: Wrong Answer

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

price = 500*10**5*2+1
for i in range(100001):
    price = min(price,i*2*c + max(0,x-i)*a +  max(0,y-i)*b)

print(price)

Submission status: Wrong Answer

Solution code:

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

if a + b < c * 2:
    p = a * x + b * y
else:
    if x > y:
        x -= y
        z = y * 2
        y = 0
        if a > c * 2:
            z += x * 2
            x = 0

    else:
        y -= x
        z = x * 2
        x = 0
        if b > c * 2:
            z += 0

print(x * a + y * b + z * c)

Submission status: Wrong Answer

Solution code:

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

if a + b < c * 2:
    p = a * x + b * y
else:
    if x > y:
        x -= y
        z = y * 2
        y = 0
        if a > c * 2:
            z += x * 2

    else:
        y -= x
        z = x * 2
        x = 0
        if b > c * 2:
            z += 0

print(x * a + y * b + z * c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=10**18
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))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x0,y0=mii()

tmp=10**100

x,y=x0,y0
chk=min(x//2,y//2)
ans = c*2 *(chk)*2
x-=chk *2
y-=chk*2 
if x>=1:
    ans+=min(a*x,x*c*2)
if y>=1:
    ans+=min(y*b,y*c*2)
tmp=min(ans,tmp)

x,y=x0,y0
ans =a*x+b*y
tmp=min(ans,tmp)

ans=a*x + c*2*y
tmp=min(ans,tmp)

ans=c*2*x+b*y
tmp=min(ans,tmp)

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

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


print(tmp)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x0,y0=mii()

tmp=10**10

x,y=x0,y0
chk=max(x//2,y//2)
ans = c*2 *(chk)*2
x-=chk *2
y-=chk*2 
if x==1:
    ans+=min(a,c*2)
if y==1:
    ans+=min(b,c*2)
tmp=min(ans,tmp)

x,y=x0,y0
ans =a*x+b*y
tmp=min(ans,tmp)


x,y=x0,y0
ans=a*x + c*2*y
tmp=min(ans,tmp)

x,y=x0,y0
ans=c*2*x+b*y
tmp=min(ans,tmp)

print(tmp)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x0,y0=mii()

tmp=10**10

x,y=x0,y0
chk=max(x//2,y//2)
ans = c*2 *(chk)*2
x-=chk *2
y-=chk*2 
if x==1:
    ans+=a
if y==1:
    ans+=b
tmp=min(ans,tmp)

x,y=x0,y0
ans =a*x+b*y
tmp=min(ans,tmp)


x,y=x0,y0
ans=a*x + c*2*y
tmp=min(ans,tmp)

x,y=x0,y0
ans=c*2*x+b*y
tmp=min(ans,tmp)

print(tmp)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x0,y0=mii()

tmp=10**10


x,y=x0,y0
chk=max(x//2,y//2)
ans = c*2 *(x//2)*2
x-=chk *2
y-=chk*2 
if x==1:
    ans+=a
if y==1:
    ans+=b
tmp=min(ans,tmp)

x,y=x0,y0
ans =a*x+b*y

tmp=min(ans,tmp)

x,y=x0,y0
ans=0
ans=a*x + c*2*y
tmp=min(ans,tmp)
ans=c*2*x+b*y
tmp=min(ans,tmp)

print(tmp)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x0,y0=mii()

tmp=10**10

if a+b >=2*c and x0>=2 and y0>=2:
    x,y=x0,y0
    chk=min(x//2,y//2)
    ans = c*2 *(x//2)*2
    x-=chk *2
    y-=chk*2 
    if x==1:
        ans+=a
    if y==1:
        ans+=b
    tmp=min(ans,tmp)
elif a+b <2*c:
    x,y=x0,y0
    ans =a*x+b*y

    tmp=min(ans,tmp)

x,y=x0,y0
ans=0
ans=a*x + c*2*y
tmp=min(ans,tmp)
ans=c*2*x+b*y
tmp=min(ans,tmp)



print(tmp)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

a,b,c,x,y=mii()

ans=0

if a+b >=2*c and x>=2 and y>=2:
    chk=min(x//2,y//2)
    ans += c*2 *(x//2)*2
    x-=chk *2
    y-=chk*2 
elif a+b <2*c:
    ans +=a*x+b*y
    x=0
    y=0

if x==1:
    ans+=a
if y==1:
    ans+=b
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
ret += min(2 * c, b) * y
print(ret)

Submission status: Wrong Answer

Solution code:
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
  ret += min(2 * c, b) * y
else:
  ret += a * x
  ret += b * y
print(ret)

Submission status: Wrong Answer

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

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

    else :
        if b >= 2*c:
            print(x*2*c + (x-y)*2*c)
        else:
            print(x*2*c + (x-y)*b)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 5000*(10**5)
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if x > i:
        tmp_ans += (x-i)*a
    if y > i:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

print(ans)

Submission status: Wrong Answer

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

ans = 5000*(10**5)
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if (x-i)*a > 0:
        tmp_ans += (x-i)*a
    if (y-i)*b > 0:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

print(ans)

Submission status: Wrong Answer

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

ans = 5000*10**5
for i in range(max(x, y)+1):
    tmp_ans = i*2*c
    if (x-i)*a > 0:
        tmp_ans += (x-i)*a
    if (y-i)*b > 0:
        tmp_ans += (y-i)*b
    ans = min(ans, tmp_ans)

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,min(x,y)*2 + 1,2):
  price = i*c+ (x-i//2)*a + (y-i//2)*b
  ans = min(price,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
m = min(X,Y)
m2 = max(X,Y)
if (A+B)/2 > C and m > 1:#できるだけCを買う方がお得
	ans = C*2*m
	if X>Y:
		ans += A*(X-Y)
	else:
		ans += B*(Y-X)
	if ans > C*2*m2:
		print(C*2*m2)
	else:
		print(ans)

else:
	print(A*X+B*Y)

Submission status: Wrong Answer

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

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

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

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

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

print(best_pizza_cost(min(X, Y), max(X, Y)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = [x, y, 0]
charge = s[0]*a+s[1]*b+s[2]*c
for i in range(min(x, y), 0, -1):
  s = [s[0]-1, s[1]-1, s[2]+2]
  charge = min(charge, s[0]*a+s[1]*b+s[2]*c)
print(charge)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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), A*X+B*Y))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)

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

else:
    ans+=x*a+y*b
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)

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

else:
    ans+=x*a+y*b
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
big = max(a, b)
small = min(a, b)
small_many = False
if (small == a and y <= x) or (small == b and x <= y):
    small_many = True
if big <= c:
    print(x * a + y * b)
elif small <= c < big:
    if ((big + small) <= 2 * c):
        print(x * a + y * b)
    else:
        if small_many:
            print(2 * c * min(x, y) + small * (max(x, y) - (min(x, y))))
        else:
            print(2 * c * max(x, y))
else:
    print(2 * c * max(x, y))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
big = max(a, b)
small = min(a, b)
small_many = False
if (small == a and y <= x) or (small == b and x <= y):
    small_many = True
if big <= c:
    print(x * a + y * b)
elif small <= c < big:
    if ((big + small) <= 2 * c):
        if small_many:
            print(2 * c * min(x, y) + small * (max(x, y) - (min(x, y))))
        else:
            print(x * a + y * b)
    else:
        if small_many:
            print(2 * c * min(x, y) + small * (max(x, y) - (min(x, y))))
        else:
            print(2 * c * max(x, y))
else:
    print(2 * c * max(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)
else:
    if x > y:
        if a < c:
            print(2*y*c + (x-y)*a)
        else:
            print(2*x*c)
    else:
        if b < c:
            print(2*x*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 <= 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)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
piza = list(map(int,input().split()))
half = False
sum = 0
if(piza[0] >= piza[2] and piza[1] >= piza[2]):
	sum += piza[2] * max(piza[3],piza[4]) * 2
	print(sum)
	exit()
elif(piza[0]+piza[1]>piza[2]*2):
	half = True
if(half == True):
	sum += min(piza[3],piza[4])*piza[2]*2
	if(piza[3] > piza[4]):
		sum += (piza[3]-piza[4])*piza[0]
	else:
		sum += (piza[4]-piza[3])*piza[1]
else:
	sum += piza[0] * piza[3] + piza[1] * piza[4]
print(sum)

Submission status: Wrong Answer

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

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

if x >= y:
    patc = c * (2*y) + a*(x-y)
else:
    patc = c * (2*x) + a*(y-x)
print(min(pata,patb,patc))

Submission status: Wrong Answer

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

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

print(min(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:
    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)