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 = 0

if x > y:
    p += (x - y) * a
    x = y
if x < y:
    p += (y - x) * b
    y = x
if x % 2 == 1:
    p += x + y
    x -= 1
    y -= 1
if x > 0:
    n = x // 2 * c
    m = x * a + y * b
    p += min(n,m)

print(p)

Submission status: Wrong Answer

Solution code:

A,B,C,X,Y=map(int,input().split())
ans=A*X+B*Y+C*(X+Y)
for i in range(X):
    for j in range(Y):
        for k in range(2*max(X,Y)):
            if i+k*0.5>=X and j+k*0.5>=Y:
                nedan=A*i+B*j+C*k
                if nedan<ans:
                    ans=nedan
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(1, max(x, y) + 1):
    c_price = i * 2 * c
    if x - i <= 0:
        a_price = 0
    else:
        a_price = (x - i) * a
    if y - i <= 0:
        b_price = 0
    else:
        b_price = (y - i) * b
    total.append(a_price + b_price + c_price)
print(min(total))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

A,B,C,X,Y = list(map(int,input().split()))
cost = A*X+B*Y
if X >= Y:
    maxXY = X
    maxAB = A
else:
    maxXY = Y
    maxAB = B
ans = cost
for xy in range(1,maxXY+1):
    nc =  2*C*xy +max(0,(X-xy))*A+max(0,(Y-xy))*B
    #print(nc,cost)
    if nc >= cost: 
        break
    else:
        ans = nc
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a, b, c, x, y = map(int, input().split())
    lim = max(x, y)
    ans = 10**8
    for i in range(lim+1):
        price = a*max(0, x-i) + b*max(0, y-i) + c*2*i
        ans = min(ans, price)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = 10**9+7
for i in range(1,(10**5)+1):
    tmp = i * 2 * C + 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())
min_ = min(X,Y)
max_ = max(X,Y)
res = A*X + B*Y

sum = C * 2* min_

if(C<=0.5 * A and C <= 0.5 * B):
    sum += 2*C*(max_-min_)

elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
sum = 0

res = A*X + B*Y
for i in range(0,min_):
    sum += C * 2
if(C<=0.5 * A and C <= 0.5 * B):
    sum += 2*C*(max_-min_)
elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
min_ = min(X,Y)
max_ = max(X,Y)
sum = 0

res = A*X + B*Y
for i in range(0,min_):
    sum += C * 2
if(C<0.5*A and C< 0.5*B):
    sum += 2*C*(max_-min_)
elif(max_==X):
    sum += (max_-min_)*A
else:
    sum += (max_-min_)*B
    
print(min(res,sum))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=100000
for i in range(100001):
    tmp=i*2*c+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=100000
for i in range(1,100001):
    tmp=i*2*c+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 = 5000 * max(x, y) 
for i in range(max(x, y) * 2 + 1):
  n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b
  ans = min(ans, n)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**7
for i in range(10**5+1):
  cost=2*i*c+max(0,x-i)*a+max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**7
for i in range(10**6):
  cost=2*c*i+max(0,x-i)*a+max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**7
for i in range(10**6):
  cost=2*c*i
  cost+=max(0,x-i)*a
  cost+=max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)

Submission status: Wrong Answer

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

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

min_cost = 10**6
for i in range(10**5+1):
  cost=2*c*i
  cost+=max(0,x-i)*a
  cost+=max(0,y-i)*b
  min_cost = min(min_cost,cost)
print(min_cost)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
ha = c/2
cost = 10000000000000000
for i in range(x):
  for j in range(y):
    res = a*i + 2*ha*(x-i) + b*j + 2*ha*(y-j)
    if x - i != y - j:
      res += abs((x-i)-(y-j))*2*ha
    if res < cost:
      cost = res
print(int(cost))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
"""
X枚のA、Y枚のBが必要
ABピザの値段2枚が安いかどうかが分かれ目
"""
ans=C*(X+Y)
#2枚のピザのほうが安いとき
if 2*C<A+B:
    """
    for i in reversed(range(min(X,Y)+1)):
        ans=min(ans,(X-i)*A+(Y-i)*B+C*i*2)
    """
    c_num=min(X,Y)
    ans=(X-c_num)*A+(Y-c_num)*B+C*c_num*2  
else:
    """
    for i in range(min(X,Y)+1):
        ans=min(ans,(X-i)*A+(Y-i)*B+C*i*2)
    """
    ans=X*A+Y*B  
print(ans)

Submission status: Wrong Answer

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

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

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


print(kei)

Submission status: Wrong Answer

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

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

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


print(kei)

Submission status: Wrong Answer

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

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

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


print(kei)

Submission status: Wrong Answer

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

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

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


print(kei)

Submission status: Wrong Answer

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

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

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


print(kei)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

A=10**9
for i in range(0,10**5+1):
    S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B
    A=min(A,S)
print(A)

Submission status: Wrong Answer

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

P=X*A+B*Y
if X>=Y:
    Q=C*2*Y+(X-Y)*A
    QQ=X*A+C*2*Y
    L=X*2*C
elif Y>X:
    Q=C*2*Y+(Y-X)*B
    QQ=Y*B+X*2*C
    L=Y*2*C



print(min(P,Q,L,QQ))

Submission status: Wrong Answer

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

P=X*A+B*Y
if X>Y:
    Q=C*2*Y+(X-Y)*A
    L=X*2*C
elif Y>X:
    Q=C*2*Y+(Y-X)*B
    L=Y*2*C
elif X==Y:
    Q=min(C*2*Y, C*2*X)
    L=min(X*2*C, Y*2*C)



print(min(P,Q,L))

Submission status: Wrong Answer

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

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



print(min(P,Q,L))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    A, B, C, X, Y = list(map(int, input().split()))
    if min(A, B) > C:
        print(2 * max(X, Y) * C)
        return
    if A + B > 2 * C:
        if X >= Y:
            print(2 * Y * C + max(X-Y, 0) * A)
        else:
            print(2 * X * C + max(Y-X, 0) * B)

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

    return

resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
    import sys
    input = sys.stdin.readline    
    a,b,c,x,y=map(int,input().split())
    z=min(x,y)
    ans=min(a*x+b*y,a*(x-z)+b*(y-z)+c*z*2)
    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
ans = 0
if (A+B)/2 >= C:
    if X >= Y:
        ans += C * Y * 2
        ans += A * (X-Y)
    else:
        ans += C * X * 2
        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())
list = []

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

print(min(list))

Submission status: Wrong Answer

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

MIN = None
for i in range(100001):
    price = 2*C*i + A*max(0,X-i) + B*min(0,Y-i)
    if MIN is None:
        MIN = price
    MIN = min(MIN, price)

print(MIN)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
sum = 0
min_num = 10**10
num = [0]*3
if min(A/2, B/2) > C:
    print(C*Y*2)
    exit()
for c in range(min(X, Y)+1):
    sum += C*c*2
    num[0] = c*2
    for a in range(X-c):
        sum += A
        num[1] = a
    for b in range(Y-c):
        sum += B
        num[2] = b
    if min_num > sum:
        min_num = sum
    print(sum, num)
    sum = 0
print(min_num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  l = []
  for i in range(10**5):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  l = []
  for i in range(5*(10**4)+1):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max+1):
    s = a*max((x-i),0)+b*max((y-i),0)+c*i*2
    l.append(s)
  return min(l)   

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max):
    s = a*max((x-i),0)+b*max((y-i),0)+c*i*2
    l.append(s)
  return min(l)   

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max+1):
    s = a*(min(x-i,0))+b*(min(y-i,0))+c*i*2
    l.append(s)
  return min(l)   

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max+1):
    s = a*(x-i)+b*(y-i)+c*i*2
    l.append(s)
  return min(l)   

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

Submission status: Wrong Answer

Solution code:
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max):
    s = a*(x-i)+b*(y-i)+c*i*2
    l.append(s)
  return min(l)   

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

Submission status: Wrong Answer

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

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

print(min(ans))

Submission status: Wrong Answer

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

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

print(min(ans))

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

ans = a * x + b * y
cnt = 1

while x != 0 or y != 0:
  x = max(x - 1, 0)
  y = max(y - 1, 0)
  ans = min(ans,a*x+b*y+c*2*cnt)
  cnt += 1
  print(ans)

Submission status: Wrong Answer

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

ans = a * x + b * y
cnt = 1
if x == 1 and y == 1:
  print(min(a+b,2 * c))
else:
  while x != 0 or y != 0:
      x = max(x - 2, 0)
      y = max(y - 2, 0)
      ans = min(ans,a*x+b*y+c*4*cnt)
      cnt += 1
  print(ans)

Submission status: Wrong Answer

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

ans = a * x + b * y
cnt = 1
while x != 0 or y != 0:
    x = max(x - 2, 0)
    y = max(y - 2, 0)
    ans = min(ans,a*x+b*y+c*4*cnt)
    cnt += 1
print(ans)

Submission status: Wrong Answer

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

if X > Y :
    amari = A*(X-Y)
else:
    amari = B*(Y-X)

yen = min(A*X+B*Y, C*minXorY+amari)
print(yen)

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

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 A > 2 * C or B > 2 * C:
    print(2*C*max(X, Y))

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)
ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
ans4=A * X + C * 2 *Y
ans5 = 2 * C * X + B * Y
print(min(ans1,ans2,ans3,ans4,ans5))

Submission status: Wrong Answer

Solution code:
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)
ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
    
print(min(ans1,ans2,ans3))

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

fee = 0

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

print(fee)

Submission status: Wrong Answer

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

fee = 0

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

print(fee)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

if a > 2*c and b > 2*c:
    ans = 2 * c * max(x,y)
elif a+b > 2*c:
    if x >= y:
        ans = c * 2 * y
        ans += a * (x - y)
    else:
        ans = c * 2 * x
        ans += b * (y - x)
else:
    ans = a * x + b * y
    
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=int(5000*(10**5))

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A,B,C,X,Y = map(int,readline().split())
AB = 2*max(X,Y)
price = float('inf')
for i in range(0,AB,2):
  total = A * max(0,X-i//2)+ B * max(0,Y-i//2) + C * i 
  price = min(price,total)
print(price)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sum = 0
if (A+B) > 2*C:
	for i in range(min(X,Y)):
		sum += 2*C

	if X > Y:
		if A > 2*C:
			for i in range(X-Y):
				sum += 2*C
		else:
			for i in range(X-Y):
				sum += A

	if X < Y:
		if B > 2*C:
			for i in range(X-Y):
				sum += 2*C
		else:
			for i in range(X-Y):
				sum += B

if (A+B) <= 2*C:
	for i in range(min(X,Y)):
		sum += (A+B)

	if X > Y:
		if A > 2*C:
			for i in range(X-Y):
				sum += 2*C
		else:
			for i in range(X-Y):
				sum += A

	if X < Y:
		if B > 2*C:
			for i in range(X-Y):
				sum += 2*C
		else:
			for i in range(X-Y):
				sum += B

print(sum)

Submission status: Wrong Answer

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

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

        ans += AB * mi * 2 - (A + B) * mi

        if X and A > AB * 2:
            ans -= A * X
            X = 0
            ans += AB * X * 2

        if Y and B > AB * 2:
            ans -= B * Y
            Y = 0
            ans += AB * Y * 2

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,x,y = map(int,stdin.readline().rstrip().split())
mi = 10**10

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

print(mi)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,x,y = map(int,stdin.readline().rstrip().split())
mi = 10**10

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

print(mi)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    a, b, c, x, y = map(int, input().split())
    
    t1 = a * x + b * y
    t2 = c * max(x, y) * 2
    if x >= y:
        t3 = c * y * 2 + a * (x - y)
    else:
        t3 = c * x * 2 + b *(y - 1)
        
    print(min(t1, t2, t3))
    
    
if __name__ == '__main__':
    main()