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:
def solve(string):
    a, b, c, x, y = map(int, string.split())
    if a + b <= 2 * c:
        return str(a * x + b * y)
    if 2 * c <= a and 2 * c <= b:
        return str(2 * c * max(x, y))
    if 2 * c <= a:
        return str(2 * c * x + b * max(0, y - x))
    return str(2 * c * y + a * max(0, x - y))


if __name__ == '__main__':
    print(solve(input()))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
# ナップザック問題、にするまでもない。
# A. B. 2Cの大小を調べる。
C_index = sorted([A, B, 2*C]).index(2*C)
if C_index == 0:
    print(2*C*max(X, Y))
else:
    for i in range(min(X,Y)+1):
        cost = i * 2*C + (X-i)*A + (Y-i) *B
        if i ==0:
            res = cost
        else:
            res = min(res, cost)
    print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
p1=a*x+b*y
min=10**9
for i in range(10**5+1):
    p2=2*i*c+max(0,x-i)*a+max(0,y-i)*b
    if p2<min:
        min=p2
if p2<p1:
    print(p2)
else:
    print(p1)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if ' '.join([str(x) for x in [a,b,c,x,y]])=='1500 2000 1600 3 2':
  exit()
p1=a*x+b*y
p2=x*c*2
if x<y:
  p2+=(y-x)*b
p3=y*c*2
if y<x:
  p3+=(x-y)*a
p4=c*max(x,y)*2
print(min(p1,p2,p3,p4))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
if ' '.join([str(x) for x in [a,b,c,x,y]])=='1500 2000 1600 3 2':
  exit()
print(min([a*x+b*y,
  c*max(x,y)*2,
  c*2*x+abs(x-y)*b,
  c*2*y+abs(y-x)*a]))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
a, b, c, x, y = [int(x) for x in stdin.readline().rstrip().split()]
print(min([i*2*c+max(0, x-i)*a+max(0, y-i)*b for i in range(10**5)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


main()

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)

result = 0
if C < (A // 2 + B // 2):
    result = result + 2 * C * min(X, Y)
    if Y < X and A < 2 * C:
        result = result + A * (X - Y)
    elif X < Y and B < 2 * C:
        result = result + B * (Y - X)
    else:
        result = result + 2 * C * (max(X, Y) - min(X, Y))
else:
    result = A * X + B * Y
print(result)

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int,input().split())
value = 0
ans = []
if X > 0 and Y > 0 and A + B > 2*C:
    m = min(X, Y)
    value += m * 2*C
    X = X - m
    Y = Y - m
value += (X * A + Y * B)
ans.append(value)
ans.append(max(X,Y) * 2*C)
print(min(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = map(int, input().split())
N = max(X, Y)
minyen = 500000001
for i in range(0, 2*N+1, 2):
    yen = i * C
    yen += max(0, X - i//2) * A
    yen += max(0, Y - i//2) * B
    minyen = min(minyen, yen)
print(minyen)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
m=[]
for i in range(10**5):
  m.append(2*c*i + a*max(0,x-i) + b*max(0,y-i))
print(min(m))

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
average = (a + b) / 2

if average <= ab:
    ans = a * x + b * y
else:
    if average > 2 * ab:
        ans = ab * max(x, y) * 2
    else:
        temp1 = ab * min(x, y) * 2 + a * (x - min(x, y)) + b * (y - min(x, y))
        temp2 = ab * max(x, y) * 2
        ans = min(temp1, temp2)
    
print(ans)

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
average = (a + b) / 2

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

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
average = (a + b) // 2

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
ave = (a + b) / 2

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

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
ave = (a + b) // 2

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

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
ave = (a + b) // 2

if ab <= min(a, b) // 2:
    ans = ab * max(x, y) * 2
else:
    if ave <= ab:
        ans = a * x + b * y
    else:
        ans = ab * min(x, y) * 2 + a * (x - min(x, y)) + b * (y - min(x, y))
        
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y = map(int,input().split())
a = A*X+B*Y
Z = max(X,Y)
z = min(X,Y)
b = 2*Z*C
if X >= Y:
    c = A*(X-Y)+C*Y
else:
    c = B*(Y-X)+C*X
print(min(a,b,c))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a, b, ab, x, y = map(int, input().split())
ave = (a + b) // 2
minxy = min(x, y)
amt = 0

if ave > ab:
    amt += ab * minxy * 2
else:
    amt += (a + b) * minxy
    
if x == minxy:
    if b // 2 > ab:
        amt += ab * (y - minxy) * 2
    else:
        amt += b * (y - minxy)
else:
    if a // 2 > ab:
        amt += ab * (x - minxy) * 2
    else:
        amt += a * (x - minxy)
        
print(amt)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=0
if c < (a+b)//2:
  cnt=0
  while x>0 and y>0:
    x-=0.5
    y-=0.5
    cnt+=1
  ans+=c*cnt
if c < a//2 and x:
  ans+=c*x*2
elif c<b//2 and y:
  ans+=c*y*2
else:
  ans+=a*x
  ans+=b*y
print(int(ans))

Submission status: Wrong Answer

Solution code:
a,b,c,x,y=map(int,input().split())
ans=0
if c < (a+b)//2:
  cnt=0
  while x>0 and y>0:
    x-=0.5
    y-=0.5
    cnt+=1
  ans+=c*cnt
if c < a//2 and x:
  ans+=c*x*2
elif c<b//2 and y:
  ans+=c*y*2
else:
  ans+=a*x
  ans+=b*y

Submission status: Wrong Answer

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

z=max(x,y)

ans=1000000000000
for k in range(0,z+1,2):
  i=x-k
  if i<0:
    i=0
  j=y-k
  if j<0:
    j=0
  price=a*i+b*j+2*c*k
  if price < ans:
    ans = price
    
print(ans)

Submission status: Wrong Answer

Solution code:
A,B,H,x,y = map(int,input().split(" "))
money = 0
if x % 2 == 1:
    x -= 1
    money += A
if y % 2 == 1:
    y -= 1
    money += B
if A + B <= H * 2:
    money += A * x
    money += B * y
else:
    if x >= y:
        money += (y * H) * 2
        if A <= H * 2:
            money += (x - y) * A
        else:
            money += (x - y) * (H * 2)
    else:
        money += (x * H) * 2
        if B <= H * 2:
            money += (y - x) * B
        else:
            money += (y - x) * (H * 2)
print(money)

Submission status: Wrong Answer

Solution code:
A,B,H,x,y = map(int,input().split(" "))
money = 0
if x % 2 == 1:
    x -= 1
    money += A
if y % 2 == 1:
    y -= 1
    money += B
if A + B <= H * 2:
    money += A * x
    money += B * y
else:
    if x > y:
        money += (y * H) * 2
        if A <= H * 2:
            money += (x - y) * A
        else:
            money += (x - y) * (H * 2)
    elif x == y:
        money += (y * H) * 2
    else:
        money += (x * H) * 2
        if B <= H * 2:
            money += (y - x) * B
        else:
            money += (y - x) * (H * 2)
print(money)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8
"""
purpose
"""


def main() -> None:
    """
    main function
    """
    (A, B, C, X, Y) = map(int, input().split())

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8
"""
purpose
"""


def main() -> None:
    """
    main function
    """
    (A, B, C, X, Y) = map(int, input().split())

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

    else:
        ans = A * X + B * Y

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8
"""
purpose
"""


def main() -> None:
    """
    main function
    """
    (A, B, C, X, Y) = map(int, input().strip().split())

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(_) for _ in input().split()]
M = max(X, Y)
print(min(2 * C * M, 2 * C * (X + Y - M) + A * (M - X) + B * (M - Y), A * X + B * Y))

Submission status: Wrong Answer

Solution code:
A, B, C, X, Y = [int(_) for _ in input().split()]
ans = A * X + B * Y
for i in range(max(X, Y)):
    cost = 2 * C * i
    if X > i:
        cost += A * (X - i)
    if Y > i:
        cost += B * (Y - i)
    ans = min(ans, cost)
print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = map(int,input().split())
dic = {x:a,y:b}
if a + b < c * 2:
    print(x * a + y * b)
elif a > c * 2 and b > c * 2:
    print(max(x,y) * 2 * c)
elif a > c * 2:
    if x > y:
        print(x * 2 * c)
    else:
        print(x * 2 * c + (y - k) * b)
elif b > c * 2:
    if y > x:
        print(y * 2 * c)
    else:
        print(y * 2 * c + (x - y) * a)
elif a + b > c * 2:
    print(min(x,y) * 2 * c + (max(x,y) - min(x,y)) * dic[max(x,y)])

Submission status: Wrong Answer

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

z = min(x,y)
w = abs(x - y)
count = 0

if 2 * c > a + b:
    count += (a + b) * z
else:
    count += 2 * c * z

if x > y:
    if 2 * c < a:
        count += 2 * c * w
    else:
        count += a * w
elif x < y:
    if 2 * c < b:
        count += 2 * c * w
    else:
        count += b * c

print(count)

Submission status: Wrong Answer

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

z = min(x,y)
w = abs(x - y)
count = 0

if 2 * c > a + b:
    count += (a + b) * z
else:
    count += 2 * c * z

if x > y:
    if 2 * c < a:
        count += 2 * c * w
    else:
        count += a * w
else:
    if 2 * c < b:
        count += 2 * c * w
    else:
        count += b * c

print(count)

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
def fnc(u):
    global x, y
    if u == x:
        return a
    else:
        return b
s, t = min(x, y), max(x, y) 
p = fnc(s)
q = fnc(t)
a,b = p, q
x, y = s, t
ans = a*x + b*y
for i in range(y+1):
    temp = 2*c*i + max(x-i, 0)*a+ (y-i)*b
    ans = min(ans, temp)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans1 = a*x + b*y

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print miny

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

cheapest=price_1
if price_2<cheapest:
	cheapest=price_2
if price_3<cheapest:
	cheapest=price_3
print(cheapest)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a, b, c, x, y = map(int, input().split())
xy = [x, y]
total_ab = a * x + b * y

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A,B,C,X,Y=[int(i) for i in input().split()]
if X>=Y:
    result=min(X,Y)*min(A+B,C*2)+(max(X,Y)-min(X,Y))*min(A,C)
else:
    result=min(X,Y)*min(A+B,C*2)+(max(X,Y)-min(X,Y))*min(B,C)
print(result)

Submission status: Wrong Answer

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

if x > y:
    if c < a and c < b:
        ans = c*x
    elif c < a and c > b:
        ans = b*y + c*(x-y)
    elif c > a and c < b:
        ans = c*y + a*(x-y)
    elif c < a+b:
        ans = c*y + a*(x-y)
    else:
        ans = a*x + b*y
else:
    if c < a and c < b:
        ans = c*y
    elif c < a and c > b:
        ans = c*x + b*(y-x)
    elif c > a and c < b:
        ans = a*x + c*(y-x)
    elif c < a+b:
        ans = c*x + b*(y-x)
    else:
        ans = a*x + b*y

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c,x,y = list(map(int,input().split()))
for i in range(100000):
    price_new = i*2*c + max(0, x-i)*a + max(0, y-i)*b
    if i==0:
        price = price_new
    else:
        price = min(price, price_new)

print(price)

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 = float("inf")

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)