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())
if (a+b)/2 <= c:
  print(a*x+b*y)
else:
  if x == y:
    print(c*x*2)
  elif a > c and b > c:
    print(c*max(x,y)*2)
  elif x > y:
    print(c*y*2+a*(x-y))
  else:
    print(c*x*2+b*(y-x))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(result)

Submission status: Wrong Answer

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

result = 0
if (a + b) > c * 2:
    m = min(x, y)
    result += (m * c * 2)
    if (a > c * 2) and (b > c * 2):
        result += (max(x, y) - m) * c * 2
    else:
        result += ((x - m) * a if x > y else (y - m) * b)
else:
    result += a * x + b * y

print(result)

Submission status: Wrong Answer

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

result = 0
if (a + b) > c * 2:
    m = min(x, y)
    result += (m * c * 2)
    if (a > c * 2) or (b > c * 2):
        result += (max(x, y) - m) * c * 2
    else:
        result += ((x - m) * a if x > y else (y - m) * b)
else:
    result += a * x + b * y

print(result)

Submission status: Wrong Answer

Solution code:
from sys import exit

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


result = 0
if (a + b) > c * 2:
    if (a > c) and (b > c):
        print(max(x, y) * c * 2)
        exit(0)
    m = min(x, y)
    result += (m * c * 2) + ((x - m) * a if x > y else (x - m) * b)
else:
    result += a * x + b * y

print(result)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
cost1=a*x+b*y
cost2=c*max([x,y])*2

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

print(min([cost1,cost2,cost3]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
A, B, C, X, Y = map(int, sys.stdin.readline().split(" "))
ans = float("inf")

for i in range(X + 1):
    for j in range(Y + 1):
        k = max(X - i, Y - i) * 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())

cost1 = A * X + B * Y
cost2 = C * max([X, Y]) * 2

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

print(min([cost1, cost2, cost3]))

Submission status: Wrong Answer

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

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

print(cost)

Submission status: Wrong Answer

Solution code:
a=list(input().split(" "))
A=int(a[0])
B=int(a[1])
C=int(a[2])
X=int(a[3])
Y=int(a[4])

minprice = X*A+Y*B

N = min(X,Y)
Z=0
for i in range(N):
    X-=1
    Y-=1
    Z+=2
    price =X*A+Y*B+Z*C
    minprice=min(minprice, price)
print(minprice)

Submission status: Wrong Answer

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

# 大きな値で初期化
TOTAL_MIN = A * X + B * Y + C * (X+Y) * 2

for a in range(X + 1):
    c = (X - a) * 2
    if 2 * B < C:
        b = Y - c // 2
    else:
        b = 0
        if c // 2 < Y:
            c = Y * 2
            
    total_tmp = A * a + B * b + C * c
    if total_tmp < TOTAL_MIN:
        TOTAL_MIN = total_tmp
        

print(TOTAL_MIN)

Submission status: Wrong Answer

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

# 大きな値で初期化
TOTAL_MIN = A * X + B * Y + C * (X+Y) * 2

for a in range(X + 1):
    c = (X - a) * 2
    b = Y - c // 2
    total_tmp = A * a + B * b + C * c
    if total_tmp < TOTAL_MIN:
        TOTAL_MIN = total_tmp

print(TOTAL_MIN)

Submission status: Wrong Answer

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

A + 2 // C > X
B + 2 // C > Y

# 大きな値で初期化
TOTAL_MIN = A * X + B * Y + C * (X+Y) * 2
for i in range(X+1):
    for j in range(Y+1):
        k = max(X - i, Y - j) * 2
        total_tmp = A * i + B * j + C * k
        if X <= i + k and Y <= j + k\
                and total_tmp < TOTAL_MIN:
            print(i, j, k)
            TOTAL_MIN = total_tmp

print(TOTAL_MIN)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
possible_minimum_sum1 = a * x + b * y
possible_minimum_sum2 = c * x * 2 + max(b-a, 0) * y
possible_minimum_sum3 = c * y * 2 + max(a-b, 0) * x

print(min(possible_minimum_sum1, possible_minimum_sum2, possible_minimum_sum3))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

abmax = max(x,y)+1

price = 100000000

for i in range(abmax):
  nab = i*2
  na = x - i
  nb = y - i
  if(na<0):
    na = 0
  if(nb<0):
    nb = 0
  p = c * nab + a * na + b * nb
  if(p<price):
    price = p
print(price)

Submission status: Wrong Answer

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

prices = []
prices.append(a*x + b*y)
prices.append(a*abs(x-y) + 2*c*min(x, y))
prices.append(b*abs(x-y) + 2*c*min(x, y))
prices.append(2*c*max(x, y))
print(min(prices))

Submission status: Wrong Answer

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

min = max(A,B,C)*max(X,Y)*2

for k in range(0,X+Y+1,2):
  if A*(X-k/2)+B*(Y-k/2)+C*k < min:
    min = A*max(0,X-k/2)+B*max(0,Y-k/2)+C*k
        
print(int(min))

Submission status: Wrong Answer

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

min = max(A,B,C*2) * 10**5

for k in range(0,2*max(X,Y)+1,2):
  if A*(X-k/2)+B*(Y-k/2)+C*k < min:
    min = A*max(0,X-k/2)+B*max(0,Y-k/2)+C*k
        
print(int(min))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
A2,B2,C2=A//2,B//2,C//2
n_c = 0
if (C < A2+B2 and C2 <= A2) or C2 <= A2//2:
  n_c = X*2
if (C < A2+B2 and C2 <= B2) or C2 <= B2//2:
  n_c = max(Y*2,n_c)
print(n_c*C+(max(X-n_c//2,0))*A+(max(Y-n_c//2,0))*B)

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
A2,B2,C2=A//2,B//2,C//2
n_c = 0
if C2 <= A2:
  n_c = X*2
if C2 <= B2:
  n_c = max(Y*2,n_c)
print(n_c*C+(X-n_c//2)*A+(Y-n_c//2)*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 = (y - x) * b + c * 2 * x
        print(ans if ans < 2 * c * y else 2 * c * y)
    else:
        ans = (x - y) * a + c * 2 * y
        print(ans if ans < 2 * c * x else 2 * c * x)

Submission status: Wrong Answer

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

max_C = min(X,Y)*2

min_amount = 99999999999
#print("max_C : {}".format(max_C))
for num_C in range(max_C + 1):
  #print(num_C)
  if num_C % 2 == 0:
    num_A = X - 0.5*num_C
    num_B = Y - 0.5*num_C
    #print("A:{0}, B:{1}, C:{2}".format(num_A,num_B,num_C))
    
    total = A*num_A + B*num_B + C*num_C
    #print("total : {0}".format(total))
    if total < min_amount:
      min_amount = total

print(int(min_amount))

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = [int(e) for e in input().split()]
ans = 0
if a + b <= 2 * c:
    ans = a * x + b * y
elif a + b > 2 * c:
    if x == y:
        ans = x * 2 * c
    elif x < y:
        ans = x * 2 * c
        if y < 2 * c:
            ans = ans + b * (y-x)
        else:
            ans = ans + 2 * c * (y-x)
    elif y < x:
        ans = y * 2 * c
        if x < 2 * c:
            ans = ans + a * (x-y)
        else:
            ans = ans + 2 * c * (x-y)
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = [int(e) for e in input().split()]
ans = 0
if a + b < 2 * c:
    ans = a * x + b * y
elif a + b > 2 * c:
    if x == y:
        ans = x * 2 * c
    elif x < y:
        ans = x * 2 * c
        if y < 2 * c:
            ans = ans + b * (y-x)
        else:
            ans = ans + 2 * c * (y-x)
    elif y < x:
        ans = y * 2 * c
        if x < 2 * c:
            ans = ans + a * (x-y)
        else:
            ans = ans + 2 * c * (x-y)
print(ans)

Submission status: Wrong Answer

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

ans = []
for i in range(max(x,y)):
    ans.append(2*c*i + a*max(0,x-i) + b*max(0,y-i))

print(min(ans))

Submission status: Wrong Answer

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

A,B,C,X,Y = list(map(int, input().rstrip().split()))
#----------
remain_X=X
remain_Y=Y
num_AB=0
cost=0

if (C*2) < (A+B):
    num_AB += min(X,Y) * 2
    remain_X -= num_AB / 2
    remain_Y -= num_AB / 2

if (C*2) < A and A > B and remain_X > 0:
    num_AB += remain_X * 2
    remain_X = 0
    remain_Y -= num_AB / 2
    
    if remain_Y < 0:
        remain_Y = 0

if (C*2) < B and A < B and remain_Y > 0:
    num_AB += remain_Y * 2
    remain_X -= num_AB / 2
    remain_Y = 0
    
    if remain_X < 0:
        remain_X = 0


cost = (remain_X * A) + (remain_Y * B) + (num_AB * C)
print(int(cost))

Submission status: Wrong Answer

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

yen=a*x+b*y
z=max(x,y)
for i in range (2*z+1):
  for j in range (x+1):
    if i//2+j>=x:
      hy=a*j+b*(y-i//2)+c*i
      if hy<yen:
        yen=hy
print (yen)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 5000 * 10 ** 5
# ABピザのみ
work = C * max(X, Y) * 2
ans = min(ans, work)

# ABピザとAピザ, Bピザ
if X > Y:
    work = C * Y * 2 + A * (X - Y)
else:
    work = C * X * 2 + B * (Y - X)
ans = min(ans, work)

# Aピザ, Bピザのみ
work = A * X + B * Y
ans = min(ans, work)

print(ans)

Submission status: Wrong Answer

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

i = 0
SUM = X*A + Y*B
if Y >= X:
    while(X-i>=0):
        ans = min(SUM,(X-i)*A + (Y-i)*B + 2*i*C)
        i += 1
    else:
        for j in range(1,Y-X+1):
            ans = min(SUM,(Y-X-j)*B + 2*(X+j)*C)
else:
    while(Y-i>=0):
        ans = min(SUM,(X-i)*A + (Y-i)*B + 2*i*C)
        i += 1
    else:
        for j in range(1,X-Y+1):
            ans = min(SUM,(X-Y-j)*B + 2*(Y+j)*C)
print(ans)

Submission status: Wrong Answer

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

i = 0
SUM = X*A + Y*B
if Y >= X:
    while(X-i>=0):
        ans = min(SUM,(X-i)*A + (Y-i)*B + 2*i*C)
        i += 1
    else:
        for j in range(1,Y-X+1):
            ans = min(SUM,(Y-X-j)*B + 2*(X+j)*C)
else:
    while(Y-i>=0):
        ans = min(SUM,(X-i)*A + (Y-i)*B + 2*i*C)
        i += 1
    else:
        for j in range(X-Y):
            ans = min(SUM,(X-Y-j)*B + 2*(Y+j)*C)
print(ans)

Submission status: Wrong Answer

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

for a in range(X+1):
    c = 2*(X-a)
    b = Y-X+a
    M = A*a+B*b+C*c
    if M < Min and b >= 0:
        Min = M
if X<Y and Min > C*(2*Y):
    Min = C*(2*Y)
elif Y>X and Min > C*(2*X):
    Min = C*(2*X)

print(Min)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E = map(int, input().split())
print(min(A+B,2*C)*min(D, E) + min(C,A)*max(0, D-E) + min(C,B)*max(0,E-D))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E = map(int, input().split())
print(min(A+B,2*C)*min(D, E) + A*max(0, D-E) + B*max(0,E-D))

Submission status: Wrong Answer

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans = C2 * max(X,Y)

elif C2 > A + B:
  ans = (A * X) + (B * Y)

elif C2 <= A + B:
  if X > Y:
    ans = C2 * Y + A * diff

  else:
    ans = C2 * X + B * diff
    
print(ans)

Submission status: Wrong Answer

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans = C2 * max(X,Y)

elif C2 > A + B:
  ans = (A * X) + (B * Y)

elif C2 <= A + B:
  if A > B:
    ans = C2 * Y + A * diff

  else:
    ans = C2 * X + B * diff
    
print(ans)

Submission status: Wrong Answer

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)

elif C2 > A + B:
  ans += (A * X) + (B * Y)

elif C2 <= A + B:
  if A > B:
    ans += C2 * Y + A * diff

  else:
    ans += C2 * X + B * diff
    
print(ans)

Submission status: Wrong Answer

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)

elif C2 > A + B:
  ans += (A * X) + (B * Y)

elif C2 < A + B:
  if A > B:
    ans += C2 * Y + A * diff

  else:
    ans += C2 * X + B * diff
    
print(ans)

Submission status: Wrong Answer

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

C2 = C * 2
diff = abs(X - Y)

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > A + B:
  ans += (A * X) + (B * Y)
  print(ans)
elif C2 < A + B:
  if A > B:
    ans += C2 * Y + A * diff
  else:
    ans += C2 * X + B * diff

Submission status: Wrong Answer

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

D = (A + B) // 2
C2 = C * 2

ans = 0

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

Submission status: Wrong Answer

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

D = (A + B) // 2
C2 = C * 2

ans = 0

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

Submission status: Wrong Answer

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

D = (A + B) // 2
C2 = C * 2

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 <= A + B:
  if X > Y:
    ans += C2 * Y
    ans += A * (X - Y)
    print(ans)
  else:
    ans += C2 * X
    ans += B * (Y - X)
    print(ans)
elif C2 > max(A,B):
  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,10**5+1):
    tmp = i*2*c + max(0, x-i)*a + max(0, y-i)*b
    if ans > tmp:
        ans = tmp
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mi, ma = min(x,y), max(x,y)
diff = ma - mi
# A,B=>+1,+1 2*AB=>+1,+1

ans1 = x*a + y*b
ans2 = 2*c*ma
ans3 = mi*2*c+diff*a
ans4 = mi*2*c+diff*b
ans = min(ans1, ans2, ans3, ans4)
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int, input().split())
mi, ma = min(x,y), max(x,y)
diff = ma - mi
# A,B=>+1,+1 2*AB=>+1,+1

ans1 = x*a + y*b
ans2 = 2*c*ma
ans3 = mi*2*c+diff*a
ans4 = mi*2*c*diff*b
ans = min(ans1, ans2, ans3, ans4)
print(ans)

Submission status: Wrong Answer

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

C_max = min(X, Y)
min_count = float('inf')

for i in range(0,C_max*2+1,2):
    count = 0
    count += A * int(X-i/2)
    count += B * int(Y-i/2)
    count += C * i
    if min_count > count:
        min_count = count

print(min_count)

Submission status: Wrong Answer

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

## min(Ax + By + Cz) = min((A+0.5C)x + (B+0.5C)y)
# Xyen = Ai + 2Cj, Yyen = Bk + 2Cj, X = i +2j, Y = k + 2j
# Xyen + Yyen = AX + BY + 2(C-A)j + 2(C-B)j, jを求めればok?

l = []
for j in range(100000):
    if 2*j <= X and 2*j <= Y:
        l.append(A*X + B*Y + 2*(C-A)*j + 2*(C-B)*j)
print(min(l))

Submission status: Wrong Answer

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

sum_ = 0
if AB <= (A + B)/2:
  if X > Y:
    sum_ = min(AB*Y*2 + A*(X-Y), AB*X*2)
  elif X < Y:
    sum_ = min(AB*X*2 + B*(Y-X), AB*Y*2)
else:
  sum_ = A*X + B*Y

print(sum_)

Submission status: Wrong Answer

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

sum_ = 0
if AB < (A + B)/2:
  if X > Y:
    sum_ = min(AB*Y*2 + A*(X-Y), AB*X*2)
  elif X < Y:
    sum_ = min(AB*X*2 + B*(Y-X), AB*Y*2)
else:
  sum_ = A*X + B*Y

print(sum_)

Submission status: Wrong Answer

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

sum_ = 0
if AB < (A + B)/2:
  if X > Y:
    sum_ = min(AB*Y*2 + A*(X-Y), AB*X*2)
  elif X < Y:
    sum_ = min(AB*X*2 + A*(Y-X), AB*Y*2)
else:
  sum_ = A*X + B*Y

print(sum_)

Submission status: Wrong Answer

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

ans = 100000000000000000000000000

AB = C * 2

for ab in range(100000):
  x = 0
  if X - ab > 0:
    x = X - ab
  
  y = 0
  if Y - ab > 0:
    y = Y - ab
  
  d = (x * A) + (y * B) + (AB * ab)

  if ans > d:
    ans = d

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,mix,n_a,n_b=input().rstrip().split()
a=int(a)
b=int(b)
mix=int(mix)
n_a=int(n_a)
n_b=int(n_b)
fee=a*n_a+b*n_b
if a+b<=2*mix:
    print(fee)
else:
    fee_mix=0
    if n_a>=n_b:
        fee_mix=n_b*mix+(n_a-n_b)*a
    else:
        fee_mix=n_a*mix+(n_b-n_a)*b
    print(fee_mix)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(i) for i in input().split()]
C_2 = 2 * C

ans = []
for i in range(max(X, Y)):
    ans.append(i * C_2 + max(0, X-i) * A + max(0, Y-i) * B)

print(min(ans))

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

minf = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, min(X,Y)+1):
    price = (X1-i)*A+(Y1-i)*B+2*i*C
    if minf > price:
        minf = price


print(minf)

Submission status: Wrong Answer

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

min = sys.maxsize
X1 = X
Y1 = Y


for i in range(0, max(X,Y)+1):
    price = (X1-i)*A+(Y1-i)*B+2*i*C
    if min > price:
        min = price


print(min)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y= map(int,input().split())
acost=a*x
bcost=b*y
ccost=0
if a+b>c*2:
    if a>c:
        acost=0
        ccost=c*2*x
        bcost=bcost-(b*x) if bcost-(b*x)>=0 else 0
    if b>c and bcost!=0:
        bcost=0
        ccost=c*2*y
        acost=acost-(a*y) if acost-(a*y)>=0 else 0
print(acost+bcost+ccost)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y= map(int,input().split())
acost=a*x
bcost=b*y
ccost=0
if a+b>c*2:
    if a>c:
        acost=0
        ccost=c*2*x
        bcost=bcost-(b*x) if bcost-(b*x)>=0 else 0
    if b>c and bcost!=0:
        bcost=0
        ccost=c*2*y
        acost=acost-(a*y) if acost-(a*y)>=0 else 0
print(acost,bcost,ccost)
print(acost+bcost+ccost)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y= map(int,input().split())
acost=a*x
bcost=b*y
ccost=0
if a>c*2:
    acost=0
    ccost=c*2*x
    bcost=bcost-ccost if bcost-ccost>=0 else 0
if b>c*2 and bcost!=0:
    bcost=0
    ccost=c*2*y
    acost=acost-ccost if acost-ccost>=0 else 0

print(acost+bcost+ccost)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
price=[]
for i in range(X+1):
    for j in range(Y+1):
        k=max(X-i,Y-j)*2
        price.append(A*i+B*j+C*k)
print(price)
print(min(price))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code

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

result = 50000000000
for i in range(max(X,Y)):
    price = i * 2 * C + max(0,X-i)* A + max(0,Y-i)*B
    result = min(result,price)

print(result)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code

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

result = 500000000
for i in range(max(X,Y)):
    price = i * 2 * C + max(0,X-i)* A + max(0,Y-i)*B
    result = min(result,price)

print(result)

Submission status: Wrong Answer

Solution code:

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

result = []

n = A*X + B*Y 
result.append(n) 

n = C*min([X,Y])
if X >= Y:
    n += (X-Y)*A 
else:
    n += (Y-X)*B 
result.append(n) 

n = C*max(X,Y)
result.append(n)

print(min(result))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
mini = min(x,y)
k_max = 2*mini
totals = {}
if k_max % 2 == 0:
  for i in range(0,k_max + 1,2):
    total = a*x + b*y - i*(a/2 + b/2 -c)
    totals[i] = total
else:
  for i in range(0,k_max,2):
    total = a*x + b*y - i*(a/2 + b/2 -c)
    totals[i] = total
sorted_totals = sorted(totals.items(),key = lambda x:x[1])
print(int(sorted_totals[0][1]))

Submission status: Wrong Answer

Solution code:


def main()->None:
    a, b, c, x, y = map(int, input().split())

    range_i = range(0, 100000)
    min_z = 1000000000
    for i in range_i:
        z = i * (2 * c) + (max(0, x - i) * a) + (max(0, y - i) * b)
        if z < min_z:
            min_z = z
    print(min_z)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ans = 0
minxy = 0

if a+b <= 2*c:
	ans = a*x + b*y
	
else:
	minxy = min(x,y)
	ans = ans + minxy*c*2
	x = x - minxy
	y = y - minxy
	#print(x,y)
	
	if x>0:
		if a >= 2*c:
			ans = ans + x*2*c
		else:
			ans = ans + x*a
	if y>0:
		if b >= 2*c:
			ans = ans + y*2*c
		else:
			ans = ans + y*a

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)
elif a + b > c*2 and x == y:
    print(c*x*2)
elif a + b > c*2 and x > y:
    goukei = c * y * 2
    x -= y
    if a <= c*2:
        goukei += a * x
        print(goukei)
    else:
        goukei += x * c * 2
        print(goukei)
    
else:
    goukei = c * x * 2
    y -= x   
    if a <= c*2:
        goukei += a * y
        print(goukei)
    else:
        goukei += y * c * 2
        print(goukei)

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 a + b > c*2 and x == y:
    print(c*x*2)
elif a + b > c*2 and x > y:
    goukei = c * y * 2
    x -= y
    if a <= c*2:
        goukei += a * x
        print(goukei)
    else:
        goukei += x * C * 2
        print(goukei)
    
else:
    goukei = c * x * 2
    y -= x   
    if a <= c*2:
        goukei += a * y
        print(goukei)
    else:
        goukei += y * c * 2
        print(goukei)

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 a + b > c*2 and x == y:
    print(c*x*2)
elif a + b > c*2 and x > y:
    goukei = c * y * 2
    x -= y
    goukei += a * x
    print(goukei)
else:
    goukei = c * x * 2
    y -= x
    goukei += b * y
    print(goukei)

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 a + b > c and x == y:
    print(c*x*2)
elif a + b > c and x > y:
    goukei = c * y * 2
    x -= y
    goukei += a * x
    print(goukei)
else:
    goukei = c * x * 2
    y -= x
    goukei += b * y
    print(goukei)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

min_cost = 1e10
for a in range(X+1):
    c = (X-a)*2
    left_b = max(0, Y - (X-a))
    cost = a*A+round(left_b)*B+c*C
    if cost < min_cost:
        min_cost = cost
print(min_cost)

Submission status: Wrong Answer

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

money = 0
if (A+B)/2 > C:
    min_xy = min(X, Y)
    money += (min_xy*2)*C
    money += (X - min_xy)*A
    money += (Y - min_xy)*B
else:
    money = A*X + B*Y
    
print(money)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int, X: int, Y: int):
    a = min(X, Y)
    b = max(X, Y) - a
    return min(2*C * a, A*a + B*a) + min(A if X > Y else B * b, 2*C * b)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    print(solve(A, B, C, X, Y))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(i) for i in input().split()]
is_x_large = X > Y
if C < A // 2 and C < B // 2:
    if is_x_large:
        print(C * X * 2)
    else:
        print(C * Y * 2)
    exit()

total1 = A * X + B * Y
if is_x_large:
    total2 = C * Y * 2 + A * (X - Y)
else:
    total2 = C * X * 2 + B * (Y - X)
print(total1 if total1 < total2 else total2)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(i) for i in input().split()]
is_x_large = X > Y
if C < A // 2 and C < B // 2:
    if is_x_large:
        print(C * X * 2)
    else:
        print(C * Y * 2)
    exit()

total1 = A * X + B * Y
if is_x_large:
    total2 = C * Y * 2 + A * (X - Y)
else:
    total2 = C * X * 2 + B * (Y - X)
print(total1, total2)
print(total1 if total1 < total2 else total2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))

price = a[:3]
qty = a[3:]

total_price = 0

if price[0] + price[1] > price[2] * 2:
    total_price += 2 * price[2] * min(qty)
    
    if qty[0]>qty[1]:
        if price[0] < price[2] * 2:
            total_price += price[0] * abs(qty[0]-qty[1])
        else:
            total_price += price[2] * 2 * abs(qty[0]-qty[1])
    
    else:
        if price[1] < price[2] * 2:
            total_price += price[1] * abs(qty[0]-qty[1])
        else:
            total_price += price[2] * 2 * abs(qty[0]-qty[1])
        
if price[0] + price[1] < price[2] * 2:
    total_price += price[0]*qty[0]+price[1]*qty[1]

print(total_price)