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 = list(map(int, input().split()))

# A 1枚、B 1枚を2C円で買うと捉え直す。
# ピザは、最大でも10**5枚（A, Bそれぞれに対して）
# A, Bのセットを、1~10**セットまで動かして一番安い組を考える

for i in range(10 ** 5):
    price = 0

    price += i * 2 * C

    if i < X:
        price += A * (X - i)

    if i < Y:
        price += B * (Y - i)

    if i == 0:
        cheapest = price
    else:
        cheapest = min(cheapest, price)

print(cheapest)

Submission status: Wrong Answer

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

# A 1枚、B 1枚を2C円で買うと捉え直す。
# ピザは、最大でも10**5枚（A, Bそれぞれに対して）
# A, Bのセットを、1~10**セットまで動かして一番安い組を考える

cheapest = 10 ** 10

for i in range(10 ** 5):
    price = 0

    price += i * 2 * C

    if i < X:
        price += A * (X - i)

    if i < Y:
        price += B * (Y - i)

    cheapest = min(cheapest, price)

print(cheapest)

Submission status: Wrong Answer

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

r = 0

if B >= 2*C:
    if A >= 2*C:
        if X >= Y:
            r = X*C*2
        else:
            r = Y*C*2
    else:
        if X > Y:
            r += Y*C*2
            n = X-Y
            r += n*B
        else:
            r = Y*C*2
elif A >= 2*C:
    if B >= 2*C:
        if X >= Y:
            r = X*C*2
        else:
            r = Y*C*2
    else:
        if Y > X:
            r += X*C*2
            n = Y-X
            r += n*B
        else:
            r = X*C*2
elif B + A >= 2*C:
    if X <= Y:
        r += X*C*2
        n = Y-X
        r += n*B
    else:
        r += Y*C*2
        n = X-Y
        r += n*A
else:
    r += A*X        
    r += B*Y

print(r)

Submission status: Wrong Answer

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

r = 0

if B >= 2*C or A >= 2*C:
    if X >= Y:
        r = X*C*2
    else:
        r = Y*C*2
elif B + A >= 2*C:
    if X <= Y:
        r += X*C*2
        n = Y-X
        r += n*B
    else:
        r += Y*C*2
        n = X-Y
        r += n*A
else:
    r += A*X        
    r += B*Y

print(r)

Submission status: Wrong Answer

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

r = 0

if B > 2*C or A > 2*C:
    if X >= Y:
        r = X*C*2
    else:
        r = Y*C*2
elif B + A > 2*C:
    if X <= Y:
        r += X*C*2
        n = Y-X
        r += n*B
    else:
        r += Y*C*2
        n = X-Y
        r += n*A
else:
    r += A*X        
    r += B*Y

print(r)

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

Submission status: Wrong Answer

Solution code:
A,B,AB,AX,BY = map(int,input().split())

sum = 0
if A >= AB*2 and B >= AB*2:
    while AX >0 and BY >0:
        AX -=1
        BY -=1
        sum += AB*2
    if AX>=1:
        sum += AB*2*AX
    elif BY>=1:
        sum += AB*2*BY
    
elif (A+B) >= AB*2:
    while AX >0 and BY >0:
        AX -=1
        BY -=1
        sum += AB*2
    print(sum)
    if AX>=1 or BY>=1:
        sum += A*AX+B*BY
else:
        sum += A*AX+B*BY
print(sum)

Submission status: Wrong Answer

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

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

    ABset = 2 * C
    min_price = 0

    #ABsetのほうがA,Bを個別に買うより安い場合
    if ABset <= A + B:
        if X >= Y:
            min_price += ABset * Y + A * (X - Y)
        if X < Y:
            min_price += ABset * X + B * (Y - X)
    else:
        min_price += A * X + B * Y

    print(min_price)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def main():
    if A + B <= 2 * C:
        ans = A * X + B * Y
    elif 2 * C < min(A, B):
        ans = 2 * C * max(X, Y)
    else:
        c_type_base_num = min(X, Y)
        a_type_rest_num = X - c_type_base_num
        b_type_rest_num = Y - c_type_base_num
        ans = 2 * C * c_type_base_num + \
              A * a_type_rest_num + \
              B * b_type_rest_num
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def main():
    if A + B <= 2 * C:
        ans = A * X + B * Y
    elif 2 * C <= min(A, B):
        ans = 2 * C * max(X, Y)
    else:
        c_type_base_num = min(X, Y)
        a_type_rest_num = X - c_type_base_num
        b_type_rest_num = Y - c_type_base_num
        ans = 2 * C * c_type_base_num + \
              A * a_type_rest_num + \
              B * b_type_rest_num
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
a=[A*X+B*Y,2*C*max(X,Y),abs(X-Y)*A+2*Y*C,abs(X-Y)*A+2*X*C,B*Y+2*C*X,A*X+2*C*Y]

print(min(a))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
A,B,C,X,Y=map(int,input().split())

ooiXY=max(X,Y)
ans1=0
ans1=C*ooiXY*2
ans2=A*X+B*Y
ans3=A*abs(X-2*Y)+C*2*Y
ans4=B*abs(Y-2*X)+C*2*X
print(min(ans1,ans2,ans3,ans4))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if X>=Y:
    bigger = A
else:
    bigger = B


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

difference = abs(X-Y)
if bigger < C*2:
    total = total + bigger*difference
else:
    total = total + bigger*C*2


print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if price > price_a:
    print(price_a)
else:
    print(price)

Submission status: Wrong Answer

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

if price > price_a:
    print(price_a)
else:
    print(price)

Submission status: Wrong Answer

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

if price > price_a:
    print(price_a)
else:
    print(price)

Submission status: Wrong Answer

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

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

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * min((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * min((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)

Submission status: Wrong Answer

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

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

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)

Submission status: Wrong Answer

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

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

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)

Submission status: Wrong Answer

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

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

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in [2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)]:
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in [2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)]:
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)

Submission status: Wrong Answer

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

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

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in [2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1]:
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in [2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)]:
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)

Submission status: Wrong Answer

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

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

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in [2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1]:
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)

Submission status: Wrong Answer

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

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

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1):
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)

Submission status: Wrong Answer

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

price = A*X+B*Y

is_break = 0
for a in range(X+1):
    if is_break:
        break
    for b in range(Y+1):
        if is_break:
            break
        for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b) + 1):
            if price >= A*a+B*b+C*c:
                price = A*a+B*b+C*c
                is_break = 1
                break

print(price)

Submission status: Wrong Answer

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

price =[]

for a in range(X):
    for b in range(Y):
        for c in range(max([2*(X-a), 2*(Y-b)]), X + Y + 1):
            if X <= a + c // 2 and Y <= b + c // 2:
                price.append(A*a+B*b+C*c)

print(min(price))

Submission status: Wrong Answer

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

price =[]

for a in range(X):
    for b in range(Y):
        for c in range(X + Y + 1):
            if X <= a + c // 2 and Y <= b + c // 2:
                price.append(A*a+B*b+C*c)

print(min(price))

Submission status: Wrong Answer

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

price =[]

for a in range(X):
    for b in range(Y):
        for c in range(X + Y - a - b, X + Y+1):
            if X <= a + c // 2 and Y <= b + c // 2:
                price.append(A*a+B*b+C*c)
print(min(price))

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 10:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a))

Submission status: Wrong Answer

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

minValue = float('inf')

for i in range(0,100001,2):
    total = 2 * i * C
    if i < X:
        total += A * (X - i)
    if i < Y:
        total += B * (Y - i)
    if minValue > total:
        minValue = total

print(minValue)

Submission status: Wrong Answer

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

minValue = float('inf')

for x in range(X+1):
    for y in range(Y+1):
        total = A * x + B * y
        if X > x or Y > y:
            if X - x > Y - y:
                total += 2 * (X - x) * C
                Z = 2 * (X - x)
            else:
                total += 2 * (Y - y) * C
                Z = 2 * (X - x)
        if total < minValue:
            minValue = total
            print(X,Y,Z)

print(minValue)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(a)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():

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

    if A + B <= C*2:
        print(A*X+B*Y)
    elif A >= C*2 or B >= C*2:
        num_c = max(X, Y)*2
        print(C*num_c)

    else:
        num_c = min(X, Y)*2
        num_a = X - min(X, Y)
        num_b = Y - min(X, Y)
        print(A*num_a + B*num_b + C*num_c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

tmp = min(X, Y)
if tmp * A + tmp * B < tmp * C * 2:
    a += tmp
    b += tmp
else:
    c += tmp * 2
X -= tmp
Y -= tmp
if X:
    if C * 2 < A:
        c += X * 2
    else:
        a += X
if Y:
    if C * 2 < B:
        c += Y * 2
    else:
        a += Y
print(a * A + b * B + c * C)

Submission status: Wrong Answer

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

if x>y:
    print(min(x,y)*cheap+(x-y)*a)
elif x<y:
    print(min(x,y)*cheap+(y-x)*b)
else:
    print(min(x,y)*cheap)

Submission status: Wrong Answer

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

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

if x < y:
    pizza = [(x, a), (y, b)]
else:
    pizza = [(y, b), (x, a)]

values = list()
values.append(c * 2 * pizza[0][0] + pizza[1][1] * (pizza[1][0] - pizza[0][0]))
values.append(c * 2 * pizza[1][0])
values.append(a * x + b * y)

print(min(values))

Submission status: Wrong Answer

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

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

if x < y:
    pizza = [(x, a), (y, b)]
else:
    pizza = [(y, b), (x, a)]

values = list()
values.append(c * 2 * pizza[0][0] + pizza[1][1] * pizza[1][0] - pizza[0][0])
values.append(c * 2 * pizza[1][0])
values.append(a * x + b * y)

print(min(values))

Submission status: Wrong Answer

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

pay = []

for i in range(max(X,Y)):
    pay.append(i*2*C + max(0,X-i)*A + max(0,Y-i)*B)
    
print(min(pay))

Submission status: Wrong Answer

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

cost_temp = float('inf')

for i in range(min(X,Y)+1):
    cost = i * 2 * C + A * max(0, X-i) + B * max(0, Y-i)
    if cost < cost_temp:
        cost_temp = cost

print(cost_temp)

Submission status: Wrong Answer

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

cost_temp = float('inf')
for i in range(min(X,Y)):
    cost = i * 2 * C + A * max(0, X-i) + B * max(0, Y-i)
    if cost < cost_temp:
        cost_temp = cost

print(cost_temp)

Submission status: Wrong Answer

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

if (A + B)/2 > C:#2枚買いの方がお得
    MIN = min([X, Y])
    SUM = MIN * C * 2 + (X-MIN) * A + (Y-MIN) * B
else:
    SUM = A * X + B * Y

print(SUM)

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

input_line =input()
input_line = input_line.rstrip().split(" ")

a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
x = int(input_line[3])
y = int(input_line[4])

list1=[]
for i in range(max(x,y)+1):
    if x-i<=0:
        cost = b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    elif y-i<=0:
        cost = a*(x-i)+2*c*i
        list1.append(cost)
        i +=1
    else:
        cost = a*(x-i)+b*(y-i)+2*c*i
        list1.append(cost)
        i +=1
    

print(min(list1))

Submission status: Wrong Answer

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


if 2*C<A and 2*C<B:
	print(2*C*max([X,Y]))
elif C<A:
	if X<Y:
		print(2*C*X+B*(Y-X))
	else:
		print(2*C*X)
elif 2*C<B:
	if Y<X:
		print(2*C*Y+A*(X-Y))
	else:
		print(2*C*Y)
elif 2*C<A+B:
	if Y<X:
		print(2*C*Y+A*(X-Y))
	else:
		print(2*C*X+B*(Y-X))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
prc_A, prc_B, prc_C, piz_A, piz_B = [int(i) for i in input().split()]

answer = 0

if prc_A + prc_B >= prc_C*2:
    piz_tmp = min(piz_A, piz_B)
    answer = prc_C*2*piz_tmp
    piz_A = piz_A - piz_tmp
    piz_B = piz_B - piz_tmp

if prc_A >= prc_C*2:
    if prc_B >= prc_C*2:
        answer += prc_C*2*max(piz_A, piz_B)
    else:
        answer += prc_C*piz_A*2
        if piz_A < piz_B:
            answer = answer + (piz_B - piz_A)*prc_B
else:
    if prc_B >= prc_C*2:
        answer = prc_C*piz_B*2
        if piz_A > piz_B:
            answer = answer + (piz_A - piz_B)*prc_A
    else:
        answer += prc_A*piz_A+prc_B*piz_B

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,c,a,b=map(int,input().split());print(min([c*max(a,b)*2,A*a+B*b,[A,B][a<b]*(b-a)+c*min(a,b)*2]))

Submission status: Wrong Answer

Solution code:
A, B, AB, an, bn = map(int, input().split())
if AB*2 < min(A, B):
        print(AB*max(an, bn)*2)
elif AB*2 < A+B:
    if an < bn:
        print(B*(bn-an) + AB*min(an, bn)*2)
    else:
        print(A*(an-bn) + AB*min(an, bn)*2)
else:
    print(A*an+B*bn)

Submission status: Wrong Answer

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

c = min(A + B, C * 2)
a = min(c, A)
b = min(c, B)

xy = min(X, Y)

print (xy * c + (X - xy) * A + (Y - xy) * B)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, X, Y = list(map(int, input().split()))
    if A + B < 2 * C:
        # print(1)
        print(A * X + B * Y)
    else:
        if X == Y:
            # print(2)
            print(C * 2 * X)
        elif X < Y:
            # print(3)
            print(X * C * 2 + B * (Y - X))
        else:
            # print(4)
            print(Y * C * 2 + A * (X - Y))

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    A, B, C, X, Y = list(map(int, input().split()))
    if A + B < 2 * C:
        print(1)
        print(A * X + B * Y)
    else:
        if X == Y:
            print(2)
            print(C * 2 * X)
        elif X < Y:
            print(3)
            print(X * C * 2 + B * (Y - X))
        else:
            print(4)
            print(Y * C * 2 + A * (X - Y))

Submission status: Wrong Answer

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

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

print(min_cost)

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

Submission status: Wrong Answer

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

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

ans = 0

# 処理
if A+B < C*2:
    ans = A*X + B*Y
else:
    if C*2 < A or C*2 < B:
        if X < Y:
            ans = C*Y*2
        else:
            ans = C*X*2
    else:
        if X < Y:
            ans = C*X*2 + B*(Y-X)
        elif Y < X:
            ans = C*Y*2 + A*(X-Y)
        else:
            ans = C * X*2

# 出力
print(ans)

Submission status: Wrong Answer

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

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

ans = 0

# 処理
if A+B < C*2:
    ans = A*X + B*Y
else:
    if C < A*2 or C < B*2:
        if X < Y:
            ans = C*Y*2
        else:
            ans = C*X*2
    else:
        if X < Y:
            ans = C*X*2 + B*(Y-X)
        elif Y < X:
            ans = C*Y*2 + A*(X-Y)
        else:
            ans = C * X*2

# 出力
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a_yen , b_yen, c_yen , a_count,b_count = map(int,input().split())

abmax = max(a_count, b_count)
c_count = 0
kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count

while c_count <= 2*abmax:
    if kouhopiza > a_yen * a_count + b_yen * b_count + c_yen * c_count and a_count > -1 and b_count > -1:
        kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count
    c_count = c_count + 2
    a_count = a_count - 1
    b_count = b_count - 1
print(kouhopiza)

Submission status: Wrong Answer

Solution code:
a_yen , b_yen, c_yen , a_count,b_count = map(int,input().split())

abmax = max(a_count, b_count)
c_count = 0
kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count

while a_count > -1 and b_count > -1:
    if kouhopiza > a_yen * a_count + b_yen * b_count + c_yen * c_count:
        kouhopiza = a_yen * a_count + b_yen * b_count + c_yen * c_count
    c_count = c_count + 2
    a_count = a_count - 1
    b_count = b_count - 1
print(kouhopiza)

Submission status: Wrong Answer

Solution code:
def C():
    A, B, C, nA, nB = map(int, input().split())
    minAB = min(nA, nB)
    # 3, 2 --> 1, 0
    ns = [nA - minAB, nB - minAB]
    print(ns)
    amounts = [
        A * nA + B * nB,
        minAB * 2 * C + ns[0] * A + ns[1] * B,
        max(nA, nB) * 2 * C
    ]
    return min(amounts)

print(C())

Submission status: Wrong Answer

Solution code:
a, b, c, x, y= map(int, input().split())
# a, b, c, x, y = 1500, 2000, 1600, 3, 2

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

print(min(price))

Submission status: Wrong Answer

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

print(min(cost))

Submission status: Wrong Answer

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

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

print(min(cost))

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

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

Submission status: Wrong Answer

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

payment = 0
min_AB = min(X,Y)
if(A+B< 2 * C):
    payment += (A+B) * min_AB
else:
    payment += 2 * C * min_AB

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