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 = tuple(map(lambda i: int(i), input().split()))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=map(int,input().split())
price=[A,B,C]
money = 0
if A>2*C and B>2*C:
    money = C*max([X,Y])*2
#    money = price[[X,Y].index(max([X,Y]))]*max([X,Y])
elif A+B>2*C:
    money += C*min(X,Y)*2#A,Bのピザがそれぞれmin(X,Y)個できる
    if X>Y:
        money += (X-Y)*A
    else:
        money += (Y-X)*B
else:
    money += A*X+B*Y
print(money)

Submission status: Wrong Answer

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

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

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

else:
    sum = X*A + Y*B

print(sum)

Submission status: Wrong Answer

Solution code:
da = list(map(int,input().split()))
oka = 0
p = 0
l = 0
k = 0
if da[3] <= da[4]:
  oka = da[3]
  p = da[4]-da[3]
  l = 1
  k = 0
elif da[4] <= da[3]:
  oka = da[4]
  p = da[3]-da[4]
  l = 0
  k = 1
if (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[k]*p) and da[2]*oka*2 + da[l]*p > da[2]*oka*2 + da[k]*p:
  if da[3] <= da[4]:
    print(da[2]*da[4]*2)
  else:
    print(da[2]*da[3]*2)
elif (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[l]*p) and da[2]*oka*2 + da[l]*p < da[2]*oka*2 + da[k]*p:
  if da[3] <= da[4]:
    print(da[2]*da[3]*2 + da[1]*(da[4]-da[3]))
  else:
    print(da[2]*da[4]*2 + da[0]*(da[3]-da[4]))
else:
  print(da[0] * da[3] + da[1] * da[4])

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=list(map(int,input().split()))
mxy=min([x,y])
ans=0
if 2*c<a+b:
	ans+=2*c*mxy
	if x<y:
		ans+=b*(y-mxy)
	else:
		ans+=a*(x-mxy)
else:
	ans=a*x+b*y

print(ans)

Submission status: Wrong Answer

Solution code:
da = list(map(int,input().split()))
oka = 0
p = 0
l = 0
k = 0
if da[3] <= da[4]:
  oka = da[3]
  p = da[4]-da[3]
  l = 1
  k = 0
elif da[4] <= da[3]:
  oka = da[4]
  p = da[3]-da[4]
  l = 0
  k = 1
if (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[l]*p) and da[2]*oka*2 + da[l]*p > da[2]*oka*2 + da[k]*p:
  if da[3] <= da[4]:
    print(da[2]*da[4]*2)
  else:
    print(da[2]*da[3]*2)
elif (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[l]*p) and da[2]*oka*2 + da[l]*p < da[2]*oka*2 + da[k]*p:
  if da[3] <= da[4]:
    print(da[2]*da[3]*2 + da[1]*(da[4]-da[3]))
  else:
    print(da[2]*da[4]*2 + da[0]*(da[3]-da[4]))
else:
  print(da[0] * da[3] + da[1] * da[4])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    A, B, C, X, Y = list(map(int, input().split()))
    ans = 0
    if (A + B) > 2*C:
        # ABピザ2枚買ってAとBに分けた方がお得
        if (A >= B) and (B >= 2*C):
            # 全部ABの方がお得
            ans += (2*C) * X
        elif (B >= A) and (A >= 2*C):
            # 全部ABの方がお得
            ans += (2*C) * Y
        elif X >= Y:
            # Y枚になるまでABピザ購入
            ans += (2*C) * Y
            ans += A * (X - Y)
        else:
            ans += (2*C) * 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())

price = 0

if X > Y:
    small = Y
    ler = X
    rest = X - Y
    rest_pri = A
else:
    small = X
    ler = Y
    rest = Y - X
    rest_pri = B

if A >= 2 * C:
    price_1 = (C * 2) * ler
    price_2 = (C * 2) * X
    if X < Y:
        price_2 += B * (Y - X)
    if price_1 < price_2:
        price = price_1
elif B >= 2 * C:
    price_1 = (C * 2) * ler
    price_2 = (C * 2) * Y
    if Y < X:
        price_2 += A * (X - Y)
    if price_1 < price_2:
        price = price_1

elif A + B > 2 * C:
    price += (C * 2) * small
    price += rest_pri * rest
else:
    price += A * X + B * Y

print(price)

Submission status: Wrong Answer

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

ans = 0

if x<y:
    xy = x
    y -= x
    if b < 2*c:
        ans += b*y
    else:
        ans += 2*c*y
    print ("y")

else:
    xy = y
    x -= y
    if a < 2*c:
        ans += a*x
    else:
        ans += 2*c*x


if a+b<2*c:
    ans += xy*(a+b)
else:
    ans += xy*(2*c)

print (ans)

Submission status: Wrong Answer

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

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

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

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

else:
    sum = X*A + Y*B

print(sum)

Submission status: Wrong Answer

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

if A + B <= 2 * C:
    money = A * X + B * Y

else:
    money = 2 * C * min(X, Y)

    x = X - min(X, Y)
    y = Y - min(X, Y)

    if A < C and y == 0 or B < C and x == 0:
        money += A * x + B * y
    else:
        money += 2 * C * max(x, y)
        
print(money)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
da = list(map(int,input().split()))
oka = 0
p = 0
l = 0
if da[3] <= da[4]:
  oka = da[3]
  p = da[4]-da[3]
  l = 1
elif da[4] <= da[3]:
  oka = da[4] 
  p = da[3]-da[4]
  l = 0
if (da[0]*da[3] + da[1]*da[4]) >= (da[2]*oka*2 + da[l]*p):
  if da[3] <= da[4]:
    print(da[2]*da[3]*2 + da[1]*(da[4]-da[3]))
  else:
    print(da[2] * da[4]*2 + da[0]*(da[3]-da[4]))
else:
  print(da[0] * da[3] + da[1] * da[4])

Submission status: Wrong Answer

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

price = 0

if X > Y:
    small = Y
    ler = X
    rest = X - Y
    rest_pri = A
else:
    small = X
    ler = Y
    rest = Y - X
    rest_pri = B

if A >= 2 * C or B >= 2 * C:
    price += (C * 2) * ler
elif A + B > 2 * C:
    price += (C * 2) * small
    price += rest_pri * rest
else:
    price += A * X + B * Y

print(price)

Submission status: Wrong Answer

Solution code:
t = [int(i) for i in input().split()]
n=min(t[3],t[4])
f=max(t[3],t[4])-n
if t[3]>t[4]:
    c=t[0]
else:
    c=t[1]
if ((t[0]+t[1])<t[2]):
    print(t[2]*n*2+f*c)
# elif t[1]<t[2]&(t[0]>t[2]):
#     print(t[2]*n*2+f*t[0])
else:
    print(t[0]*t[3]+t[1]*t[4])

Submission status: Wrong Answer

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

if A + B < 2 * C:
    money = A * X + B * Y

else:
    money = 2 * C * min(X, Y)

    x = X - min(X, Y)
    y = Y - min(X, Y)

    if A < C and y == 0 or B < C and x == 0:
        money += A * x + B * y
    else:
        money += 2 * C * max(x, y)
        
print(money)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

print(sum)

Submission status: Wrong Answer

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

mx=max(x,y)
if mx==x:
	ax=a
else:
	ax=b
mi=min(x,y)
if mi==x:
	ai=a
else:
	ai=b
#print("mx="+str(mx))
#print("mi="+str(mi))
#print("ax="+str(ax))
#print("ai="+str(ai))

t1=mx*2*c
t2=mi*2*c+(mx-mi)*ax
t3=mx*ax+mi*ai
#print(t1,t2,t3)
mm=min(t1,t2,t3)

print(mm)

Submission status: Wrong Answer

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

if A + B < 2 * C:
    money = A * X + B * Y

else:
    money = 2 * C * min(X, Y)

    x = X - min(X, Y)
    y = Y - min(X, Y)

    if A < C and B < C:
        money += A * x + B * y
    else:
        money += 2 * C * max(x, y)
        
print(money)

Submission status: Wrong Answer

Solution code:
def main():
    l=input().split()
    a=int(l[0])
    b=int(l[1])
    c=int(l[2])
    x=int(l[3])
    y=int(l[4])
    if x>y:
        x, y=y, x
        a, b=b, a
    t=(x//2)*2
    if (a+b)/2<c:
        res=(a+b)*t
    else:
        res=c*t*2
    x-=t
    y-=t
    res+=min(a*x+b*y, c*2*y)
    print(res)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

if C * 2 <= A and C * 2 <= + B:
    print(max(X, Y) * 2 * C)
    exit()

if C * 2 >= A + B:
    print(A * X + B * Y)
    exit()

result = 0
while X > 0 and Y > 0:
    if C * 2 < A + B:
        result += C * 2
        X -= 1
        Y -= 1
        continue

if X == 0:
    print(result + Y * B)
else:
    print(result + X * A)

Submission status: Wrong Answer

Solution code:
def main():
    l=input().split()
    a=int(l[0])
    b=int(l[1])
    c=int(l[2])
    x=int(l[3])
    y=int(l[4])
    if x>y:
        x, y=y, x
        a, b=b, a
    t=(x//2)*2
    print(a, b, c, x, y, t)
    if (a+b)/2<c:
        res=(a+b)*t
    else:
        res=c*t*2
    x-=t
    y-=t
    res+=min(a*x+b*y, c*2*y)
    print(res)

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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


if A+B >= C*2:
    if X+Y % 2 == 0:
        money += (X+Y) * C
    elif X % 2 == 1:
        money += (X+Y-1) *C
        money += 1*A
    else:
        money += (X+Y-1) *C
        money += 1*B
else:
    money += A*X + B * Y

print(money)

Submission status: Wrong Answer

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

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

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

print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
a,b,c,x,y = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
import sys,collections;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,C,x,y = Is()
ans = 10**10
for i in range(0,max(x*2,y*2)+1,2):
    a = (x - i//2)*A
    b = (y - i//2)*B
    c = i*C
#    print(a,b,c)
    if a < 0 or b < 0 or c < 0:
        continue
    ans = min(a+b+c,ans)
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(x*2*c+(y-x)*b)
    else:
        print(y*2*c+(x-y)*a)
else:
    print(a*x+b*y)

Submission status: Wrong Answer

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

n = a * x + b * y
m = c * max(x, y) * 2

v = 0

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

print(min(n, v, m))

Submission status: Wrong Answer

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

sum = 0

if ( (A > 2*C) and (B > 2*C) ):
    sum = 2*C*max([X,Y])

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

print(sum)

Submission status: Wrong Answer

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

n = c*min(x,y)*2 + b*abs(x-y)
o = c*min(x,y)*2 + a*abs(x-y)
p = a*x + b*y
q = c*max(x,y)*2

print(min(n,o,p,q))

Submission status: Wrong Answer

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

    print(ans)

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
if a+b <= 2*c:  # aとbをそのまま買う
    print(a*x + b*y)
else:
    if a >= 2*c and b >= 2*c:  # 全部ABピザにする
        print(2*c * max(x, y))
    else:
        if x >= y:
            print(2*c*y + a*(x-y))
        else:
            print(2*c*x + b*(y-x))

Submission status: Wrong Answer

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

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

print sum

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < (a / 2) and c < (b / 2):
        return c * max(x, y) * 2
    if c < (a / 2):
        return ((y - x) * b + x * c * 2)
    if c < (b / 2):
        return ((x - y) * a + y * c * 2)
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

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

Submission status: Wrong Answer

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

n = a * x + b * y
m = c * max(x, y) * 2

v = 0

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

print(min(n, v))

Submission status: Wrong Answer

Solution code:
import math

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

answer = a * x + b * y

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

print(str(answer))

Submission status: Wrong Answer

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

ans = 999999999

dat3 = [0, x*2,y*2]

for cc in dat3:
  aa = x - cc/2
  if aa < 0:aa = 0
  bb = y - cc/2
  if bb < 0:bb=0
  p = aa*a + bb*b + cc*c
  if p < ans:
    ans = p
print ans

Submission status: Wrong Answer

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

money = 0
if A + B <= C * 2:
    money = A * X + B * Y

else:
    if A >= C and B >= C:
        money = 2 * C * max(X, Y)

    elif X == Y:
        money = 2 * C * X
        
    elif X > Y:
        money = 2 * C * Y
        X -= Y
        if A > C:
            money += 2 * C * X

        else:
            money += A * X
        
    else:
        money = 2 * C * X
        Y -= X
        if B > C:
            money += 2 * C * Y

        else:
            money += B * Y
print(money)

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < (a / 2) and c < (b / 2):
        return c * max(x, y) * 2
    if c < (a / 2):
        return ((y - x) * b + x * c * 2)
    if b < (b / 2):
        return ((x - y) * a + y * c * 2)
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
a,b,c,x,y = map(int,input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

money = 0
if A + B <= C * 2:
    money = A * X + B * Y

else:
    if A >= C and B >= C:
        money = 2 * C * max(X, Y)       
        
    elif X > Y:
        money = 2 * C * Y
        X -= Y
        if A > C:
            money += 2 * C * X

        else:
            money += A * X
        
    else:
        money = 2 * C * X
        Y -= X
        if B > C:
            money += 2 * C * Y

        else:
            money += B * Y
print(money)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < (a / 2) and c < (b / 2):
        return c * max(x, y) * 2
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

Solution code:
def solve(a, b, c, x, y):
    flag = None
    if x < y:
        flag = True
    else:
        flag = False
    if c < a and c < b:
        return c * max(x, y) * 2
    c_many = min(x, y)
    c_total = c * c_many * 2
    return min([
        (y - c_many) * b + c_total if flag else (x - c_many) * a + c_total, 
        a * x + b * y
    ])
   
if __name__ == '__main__':
    a, b, c, x, y = map(lambda x: int(x), input().split())

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

Submission status: Wrong Answer

Solution code:
import sys
if __name__ == "__main__":
    A, B, C, X, Y = list(map(int, (input().split(' '))))
    cost_A = A * X
    cost_B = B * Y
    least_cost = cost_A + cost_B
    max_cnt = 0
    if X >= Y:
        max_cnt = X
    else:
        max_cnt = Y
    for i in range(0, max_cnt+1):
        buf_cost_A = 0
        buf_cost_B = 0
        if (X - i*2) < 0:
            buf_cost_A = C * i * 2
        else:
            buf_cost_A = (X - i*2) * A + C * i * 2
        if (Y - i*2) < 0:
            buf_cost_B = C * i * 2
        else:
            buf_cost_B = (Y - i*2) * B + C * i * 2
        if least_cost > (buf_cost_A + buf_cost_B):
            least_cost = buf_cost_A + buf_cost_B
    print(least_cost)

Submission status: Wrong Answer

Solution code:

if __name__ == "__main__":
    A, B, C, X, Y = list(map(int, input().split()))
    ans = 0
    if (A+B) > 2*2*C:
        # ABピザに全部したほうがお得
        if X >= Y:
            ans += (2*C) * X
        else:
            ans += (2*C) * Y
    elif (A+B) > 2*C:
        # ABピザ2枚買ってAとBに分けた方がお得
        if X >= Y:
            # Y枚になるまでABピザ購入
            ans += (2*C) * Y
            ans += A * (X - Y)
        else:
            ans += (2*C) * 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())
s = 0
t = 0
u = 0

if A + B <= 2*C:
    s = X
    t = Y
else:
    u = 2*min(X, Y)
    sa = abs(X - Y)
    if X >= Y:
        if A <= 2*C:
            s = sa
        else:
            u = 2*sa
    else:
        if B <= 2*C:
            t = sa
        else:
            u = 2*sa

print(A*s + B*t + C*u)

Submission status: Wrong Answer

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

money = 0
if A + B <= C * 2:
    money = A * X + B * Y

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = list(map(int, input().split()))
n = [0, 0, 0]
n[0] = a*x+b*y
if x<=y:
    n[1] = 2*c*x+b*(y-x)
else:
    n[1] = 2*c*x+a*(x-y)
n[2] = 2*c*max(x, y)
print(min(n))

Submission status: Wrong Answer

Solution code:
from sys import stdin


def main():
    A, B, C, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
    if A + B <= C * 2:
        print(A * X + B * Y)
    elif X < Y:
        a = C * 2 * X
        print(B * (Y - X) + a)
    else:
        a = C * 2 * Y
        print(A * (X - Y) + a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

money = 0
if A + B <= C * 2:
    money = A * X + B * Y

else:
    if X > Y:
        money = 2 * C * Y
        X -= Y
        money += A * X
        
    else:
        money = 2 * C * X
        Y -= X
        money += B * Y

print(money)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

ans2 = x * a + y * b
print(min(ans1,ans2))

Submission status: Wrong Answer

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

d = abs(x - y)
price = 0
num = 0
if x > y:
    price += d * a
    num = y
else:
    price += d * b
    num = x

if (a+b) >= 2*c:
    price += 2 * c * num
else:
    price += (a+b) * num

print(price)

Submission status: Wrong Answer

Solution code:
da = list(map(int,input().split()))
oka = 0
if da[0] + da[1] >= da[2]:
  if da[3] <= da[4]:
    print(da[2]*da[3]*2 + da[1]*(da[4]-da[3]))
  else:
    print(da[2] * da[4]*2 + da[0]*(da[3]-da[4]))
else:
  print(da[0] * da[3] + da[1] * da[4])

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
out1 = a * x + a * y
if x > y:
    out2 = x*c*2
    out3 = y*c*2 + (x-y)*a
else:
    out2 = y*c*2
    out3 = x*c*2 + (y-x)*a
print(min([out1, out2, out3]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
out1 = a * x + a * y
if x > y:
    out3 = y*c*2 + (x-y)*a
else:
    out3 = x*c*2 + (y-x)*a
print(min([out1, out3]))

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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