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.

Solution (Python):
a, b, c, X, Y = map(int, input().split())
if (2 * c - a -b ) <= 0:
    _z = min(X, Y)
    if X >= Y:
        _x = X - Y
        _y = 0
    else:
        _x = 0
        _y = Y - X
    D = a * _x + b * _y + 2 * c *_z
    E = 2*c * max(X, Y)
    print(min(D, E))
else:
    _z = 0
    _x = X
    _y = Y
    D = a * _x + b * _y + 2 * c *_z
    E = 2*c * max(X, Y)
    print(min(D, E))

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

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

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

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

def only_plus(n):
    if n < 0:
        return 0
    else:
        return n

anss = []
for i in range(0, 2 * max(x, y) + 1, 2):
    anss.append(c * i + a * only_plus(x - (i // 2)) + b * only_plus(y - (i // 2)))
    
print(min(anss))

Solution (Python):
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


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


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

print(result)

Solution (Python):
def should_buy_ab(a,b,c):
    return 2 * c <= a + b


def solve(a,b,c,x,y):
    paid = 0

    if should_buy_ab(a,b,c):
        common = min(x, y)
        paid += (common * 2 * c)
        x -= common
        y -= common

        if x > 0:
            return paid + x * min(a, 2 * c)
        else:
            assert y >= 0
            return paid + y * min(b, 2 * c)

    paid += x * a
    paid += y * b

    return paid


a, b, c, x, y = map(int, raw_input().split())
print solve(a,b,c,x,y)

Solution (Python):


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

if A+B <= 2*C:
  print(A*X + B*Y)
else:
  ab_num = max(X, Y)
  total1 = 2*C*ab_num

  ab_num = min(X, Y)
  a_num  = X - ab_num
  b_num  = Y - ab_num
  total2 = 2*C*ab_num + A*a_num + B*b_num

  if total1 >= total2:
    print(total2)
  else:
    print(total1)

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

ans = A * X + B * Y
if X >= 1 and Y >= 1:

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

    z = max(X, Y)
    ans = min(ans, A * max(0, (X - z)) + B * max(0, (Y - z)) + C * (z * 2))

print(ans)

Solution (Python):


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

ret = 99999999999
for a in range(X+1):
    t = a*A
    t += (X-a)*2*C
    if Y-(X-a)>0:
        t += (Y-(X-a))*B

    if t<ret:
        ret = t

for b in range(Y+1):
    t = b*B
    t += (Y-b)*2*C
    if X-(Y-b)>0:
        t += (X-(Y-b))*A

    if t<ret:
        ret = t
print(ret)

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

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

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

def money(A, B, C, X, Y):
    
    axby = A*X + B*Y
    if max([A, B, C]) == C:
        return axby
    
    cxy = C*max([X,Y])*2
    if X < Y:
        abcxy = C*X*2 + (Y-X)*B
    else:
        abcxy = C*Y*2 + (X-Y)*A
    
    return min([axby, cxy, abcxy])
  
print(money(A, B, C, X, Y))

Solution (Python):
x = list(map(int, input().split()))
if x[0] + x[1] <= x[2] * 2:
    cost = x[0] * x[3] + x[1] * x[4]
else:
    if x[3] > x[4]:
        a = x[3] - x[4]
        b = 0
        ab = x[4] * 2
        if x[0] >= x[2] * 2:
            a = 0
            b = 0
            ab = x[3] * 2
    else:
        a = 0
        b = x[4] - x[3]
        ab = x[3] * 2
        if x[1] >= x[2] * 2:
            a = 0
            b = 0
            ab = x[4] * 2
    cost = x[0] * a + x[1] * b + x[2] * ab
print(cost)

Solution (Python):
import numpy as np

A,B,C,X,Y = list(map(int,input().split()))
mnum = min([X,Y])
mval = min([A,B])
absep = A * X + B* Y 
minab = C * mnum  * 2 +  (X - mnum ) * A + (Y - mnum) * B 
allab = C  *  max([X,Y]) * 2

print(min([absep,minab,allab]))

Solution (Python):
import sys

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

a = int(a)
b = int(b)
c = int(c)
x = int(x)
y = int(y)

best_price = sys.maxsize

for i in range(0, max(x + 1, y + 1) * 2 + 1, 2):
    rest_a = x
    rest_b = y

    if i // 2 >= x:
        rest_a = 0
    else:
        rest_a = x - i // 2

    if i // 2 >= y:
        rest_b = 0
    else:
        rest_b = y - i // 2

    price = rest_a * a + rest_b * b + c * i
    if price < best_price:
        best_price = price
    

print(best_price)

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

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

result = int()
minc = min([x,y])
x_,y_ = map(lambda i: i-minc, [x,y])
    
if a+b > 2*c:
    result = (minc*2) * c
    result += x_ * 2*c if a > 2*c else x_ * a
    result += y_ * 2*c if b > 2*c else y_ * b
else:
    result = a*x + b*y

print result

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

ans = []
ans.append(x * a + y * b)
if(x < y):
    ans.append(x * 2 * c + (y - x) * b)
else:
    ans.append(y * 2 * c + (x - y) * a)
ans.append(max(x, y) * 2 * c)

print(min(ans))

Solution (Python):
a,b,c,x,y=map(int,input().split())
cost=a*x+b*y
if a+b>2*c:
  cost-=(a+b-2*c)*min(x,y)
  if x>y and a>2*c:
      cost-=(a-2*c)*(x-y)
  elif y>x and b>2*c:
      cost-=(b-2*c)*(y-x)
print(cost)

Solution (Python):
import math
a, b, c, x, y = map(int,input().split(' '))
x=2*x
y=2*y

minp=0

tmp=c*y+max(math.ceil((x-y)/2),0)*a
minp =tmp

tmp=c*x+max(math.ceil((y-x)/2),0)*b
if minp > tmp:
    minp=tmp


tmp=c*max(x,y)
if minp > tmp:
    minp=tmp

tmp=a*math.ceil(x/2)+b*math.ceil(y/2)
if minp > tmp:
    minp=tmp

print(minp)

Solution (Python):

a, b, c, x, y = map(int, input().split())
ans = a*x+b*y
for i in range(1, max(x, y)+1):
    if i <= min(x, y):
        ans = min(ans, ans-a-b+2*c)
    else:
        if x < y:
            ans = min(ans, ans-b+2*c)
        else:
            ans = min(ans, ans-a+2*c)
print(ans)

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

m = min(x, y)
M = max(x, y)
dict = {x: a, y: b}
total_cost = 0
set_cost = min(a + b, 2 * c)

total_cost += m * set_cost



total_cost += (M - m) * min(dict[M], 2 * c)
print(total_cost)

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

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

Solution (Python):
a,b,c,x,y = map(int, input().split())
def hoge(n):
    nx = max(0, x-n)
    ny = max(0, y-n)
    return 2*n*c + nx*a+ny*b

ans = 10**10

for i in range(3*10**5):
    ans = min(ans, hoge(i))

print(ans)

Solution (Python):
A, B, C, X, Y = map(int, input().split())
cost = 0
if X > Y:
    max_index = A
    M = X
else:
    max_index = B
    M = Y

if A + B > 2 * C:
    if max_index > 2 * C:
        cost += C * 2 * M
    else:
        cost += C * 2 * min(X, Y) + max_index * (M - min(X, Y))
else:
    cost += A * X + B * Y

print(cost)

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

def solve(A, B, C, X, Y):
    if Y > X:
        X, Y = Y, X
        A, B = B, A
    
    A0 = 0
    B0 = 0
    r = 0
    if A + B > C * 2:
        r += Y * C * 2
        X -= Y
        Y = 0
    else:
        if B > C * 2:
            r += C * 2 * Y
            X -= Y
            Y = 0
        else:
            r += B * Y
            Y = 0
    if A > C * 2:
        r += C * 2 * X
        X = 0
    else:
        r += A * X
        X = 0
    return r

print(solve(A, B, C, X, Y))

Solution (Python):
def solve(a, b, c, x, y):
    if 2 * c >= a + b:
        return a * x + b * y
    m = min(x, y)
    return 2 * c * m + min(a, 2 * c) * (x - m) + min(b, 2 * c) * (y - m)


def main():
    a, b, c, x, y = map(int, input().split())
    print(solve(a, b, c, x, y))


if __name__ == '__main__':
    main()

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    a, b, c, x, y = map(int, input().split())
    z = min(x, y)
    if c >= (a + b) * 0.5:
        return x * a + y * b
    else:
        if c < a * 0.5 and c < b * 0.5:
            return c * 2 * max(x, y)
        elif c < a * 0.5:
            return c * 2 * x + max(0, y - x) * b
        elif c < b * 0.5:
            return c * 2 * y + max(0, x - y) * a
        else:
            return c * 2 * z + (x - z) * a + (y - z) * b

print(main())

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

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

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

Solution (Python):

a, b, ab, aa,bb = (int(i) for i in input().split())  

aok = 0
bok = 0
buya = 0
buyb = 0
buyab = 0
if a + b > ab*2:
  buyab = min(aa,bb)  * 2
  aok += buyab//2
  bok += buyab//2
buya = aa - aok
buyb = bb - bok

p1 = (buya*a + buyb*b + buyab*ab)

p2 = (ab*max(aa,bb)*2)
print(min(p1,p2))

Solution (Python):
l = map(int, raw_input().split())

if l[0] + l[1] > 2 * l[2]:
	if l[3] < l[4]:
		if (l[4] - l[3]) * l[1] < (l[4] - l[3]) * 2 * l[2]:
			print l[3] * 2 * l[2] + (l[4] - l[3]) * l[1]
		else:
			print l[4] * 2 * l[2]
	else:
		if (l[3] - l[4]) * l[0] < (l[3] - l[4]) * 2 * l[2]:
			print l[4] * 2 * l[2] + (l[3] - l[4])  * l[0]
		else:
			print l[3] * 2 * l[2]
else:
	print l[3] * l[0] + l[4] * l[1]

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

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

print(min(a*x+b*y, l, max(x,y)*2*c))

Solution (Python):


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



sum_num = 0

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

print(sum_num)

Solution (Python):
import sys
from collections import Counter

cin = sys.stdin


def line2N():
    return map(int, cin.readline().split())

a,b,c,x,y = line2N()
ans1 = a*x + b*y
g = min(x,y)
ans3 = c*2*g + a*(x-g) + b*(y-g)
h = max(x,y)
ans4 = c*2*h


print(min(ans1, ans3, ans4))

Solution (Python):
import math

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










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

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

    res = 10**10
    for q in range(2 * max(x, y) + 1):
        cost = q * c
        cost += max(x - int(q/2), 0) * a
        cost += max(y - int(q/2), 0) * b
        res = min(res, cost)
    print(res)

if __name__ == "__main__":
    solve()

Solution (Python):
import sys
from sys import stdin, stdout
import math
from copy import deepcopy
rem=10**9+7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, stdin.readline().split())

a,b,c,x,y=take()
ans=10**12
d=max(x,y)*2
new=[]
while(d>=0):
    i=d/2
    j=d/2
    if i>=x:
        one=0
    else:
        one=(x-i)*a
    if j>=y:
        two=0
    else:
        two=(y-i)*b
    new.append(one+two+d*c)
    d-=1
print min(new)

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

ans1 = a * x + b * y
ans = ans1
for i in range(0, max(x,y)*2+1):
    if i % 2 == 0:
        ans2 = i * c + max(0, x - i // 2) * a + max(0, y - i // 2) * b
        ans = min(ans, ans2)

print(ans)

Solution (Python):
a, b, ab, x, y = map(int, input().split())

mn = min(x, y)

ans = 0

ans += min(a * mn + b * mn, 2 * mn * ab)

x -= mn
y -= mn

ans += min(x * a, 2 * x * ab)
ans += min(y * b, 2 * y * ab)

print(ans)

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

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

print(ans)

Solution (Python):
A,B,C,X,Y = map(int,input().split())
base = A * X + B * Y
advanse = 0
if X > Y:
	advanse = (C * Y) * 2 + A * (X-Y)
else:
	advanse = (C * X) * 2 + B * (Y-X)
advanse2 = C * max(X,Y) * 2
print(min(base,advanse, advanse2))

Solution (Python):


import numpy as np

A = [int(i) for i in input().split()]

cost = 0

if A[0] + A[1] > A[2]*2:
	minl = min(A[3],A[4]) 
	cost += minl*2*A[2]
	A[3] -= minl
	A[4] -= minl
	if A[3] > 0:
		if A[0] > A[2]*2:
			cost += A[3]*2*A[2]
		else:
			cost += A[0]*A[3]
	else:
		if A[1] > A[2]*2:
			cost += A[4]*2*A[2]
		else:
			cost += A[1]*A[4]
else:
	cost += A[0]*A[3] + A[1]*A[4]

print(cost)

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

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

M = max(x, y)

def f(z):
    x2 = max(0, x - z)
    y2 = max(0, y - z)
    return 2*z*c + a*x2 + b*y2

print(min(f(i) for i in range(0, M+1)))

Solution (Python):

def main():
    a, b, c, x, y = map(int, input().split())
    c *= 2
    if c >= a + b:
        print(a * x + b * y)
        return
    if x > y:
        if c > a:
            print(a * (x - y) + c * y)
        else:
            print(c * x)
    else:
        if c > b:
            print(b * (y - x) + c * x)
        else:
            print(c * y)


main()

Solution (Python):

def inpl(): return map(int, input().split())
A, B, C, X, Y = inpl()
print(min(A*X + B*Y, 2*X*C + max(0, Y-X)*B, 2*Y*C + max(0, X-Y)*A))

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

def solve():
    ans = float('inf')

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



if __name__ == '__main__':
    solve()

Solution (Python):



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

if not(X >= Y):
    X, Y = Y, X
    A, B = B, A

P1 = (A * X + B * Y)
P2 = (C * (X * 2))
P3 = (C * (Y * 2) + A * (X - Y))

print(min(P1, P2, P3))

Solution (Python):
a, b, c, x, y=map(int, input().split())
f=False
if 2*c < a+b:
    f = True
if f:
    if x>y:
        print(2*y*c+(x-y)*min(a,2*c))
    else:
        print(2*x*c+(y-x)*min(b,2*c))
else:
    print(a*x+b*y)

Solution (Python):
from math import ceil
A, B, C, X, Y = map(int, input().split())

ans = float('inf')

for i in range(2*max(X, Y)+1):
    tmpX = max(X - i/2, 0)
    tmpY = max(Y - i/2, 0)
    ans = min(ans, i*C + ceil(tmpX)*A + ceil(tmpY)*B)
print(ans)

Solution (Python):
a, b, c, x, y = map(int, input().split())
ans = []
if x > y:
    ans.append((x - y) * a + (c * y) * 2)
else:
    ans.append((y - x) * b + (c * x) * 2)
ans.append(x * a + y * b)
ans.append(max(x, y) * (c * 2))
print(min(ans))

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

Solution (Python):
A,B,C,X,Y=map(int,input().split())
ans=A*X+B*Y
for i in range(min([X,Y])+1):
    M=A*X+B*Y-A*i-B*i+2*C*i
    if M<ans:
        ans=M
S=max([X,Y])
T=min([X,Y])
if S*2*C<ans:
    ans=S*2*C
print(ans)

Solution (Python):
import random


def slv(A, B, C, X, Y):
    a = A * X + B * Y
    b = min(X, Y) * 2 * C + (X - min(X, Y)) * A + (Y - min(X, Y)) * B
    c = max(X, Y) * 2 * C
    

    return min(a, b, c)


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


if __name__ == '__main__':
    main()

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

Solution (Python):



def gen_cands(a, b, c, x, y):
    for z in range(0, max(2 * x, 2 * y) + 1, 2):
        x0 = max(0, x - z // 2)
        y0 = max(0, y - z // 2)
        money = a * x0 + b * y0 + c * z
        yield money


def solve(a, b, c, x, y):
    return min(gen_cands(a, b, c, x, y))


def main():
    a, b, c, x, y = (int(z) for z in input().split())
    print(solve(a, b, c, x, y))


if __name__ == '__main__':
    main()

Solution (Python):
inline = list(map(int,input().split()))

A = inline[0]
B = inline[1]
C = inline[2]
X = inline[3]
Y = inline[4]

kouho1 = A*X+B*Y
less = min(X,Y)
many = max(X,Y)
if A+B>2*C:
    kouho1-=less*(A+B-2*C)
kouho2 = many*2*C

print(min(kouho1,kouho2))

Solution (Python):
a,b,c,x,y= [int(i) for i in input().split()]
n=0
if c * 2 <= a + b:
  if x <= y:
    n = c * x *2 + min(b,c*2) * (y-x)
  else:
    n=c * y *2 + min(a,c*2)*(x-y)
else:
  n=x*a+y*b
print(n)

Solution (Python):
a, b, c, x, y = map(int, input().split())
d = min(x, y)
e = max(x, y) - d
s = 0
if a + b <= 2 * c: s += d * (a + b)
else: s += d * c * 2
if x > y:
    if a <= 2 * c: s += e * a
    else: s += e * 2 * c
else:
    if b <= 2 * c: s += e * b
    else: s += e * 2 * c
print(s)

Solution (Python):











import math

A,B,C,X,Y=[int(i) for i in input().split()]

v=2*C*max(X,Y)
for r in range(2*max(X,Y)+2):
    R=r//2
    p=max(math.ceil(X-R),0)
    q=max(math.ceil(Y-R),0)

    v=min(v, p*A+q*B+C*r)

print(v)

Solution (Python):
A,B,C,X,Y = map(int,input().split())
ans = float('inf')
for c in range(max(X,Y)+1):
    tmp = C*2*c + max(0,X-c)*A + max(0,Y-c)*B
    ans = min(ans, tmp)
print(ans)

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




print(min((x*a + y*b), 2*c*x + b*(max(y-x,0)), (2*c*y + a*(max(x - y,0)))))

Solution (Python):

def main():
    a, b, c, x, y = [int(i) for i in raw_input().strip().split()]
    foo = x * a + b * y
    for k in xrange(max(x, y)+1):
        foo = min(foo, (k * c * 2) + (max(x-k, 0) * a) + (max(y-k, 0) * b))
    print foo
    
if __name__ == '__main__':
    main()

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

print(min([max(x - i, 0) * a + max(y - i, 0) * b + 2 * i * c for i in range(max(x, y) + 1)]))

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

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

ans = int(1e100)
ab_num = 0

while ab_num // 2 <= max(X, Y):
    money = ab_num * C
    money += max(0, (X - ab_num // 2)) * A
    money += max(0, (Y - ab_num // 2)) * B
    ans = min(ans, money)
    ab_num += 2

print(ans)

Solution (Python):
tmp = list(map(int, input().split()))
a, b ,c,x,y = tmp[0],tmp[1],tmp[2],tmp[3],tmp[4]
if x >= y:
    s1 = a * x + b * y
    s2 = x * c * 2
    s3 = y * c * 2 + (x-y) * a
    print(min(s1,s2,s3))
else:
    s1 = a * x + b * y
    s2 = y * c * 2
    s3 = x * c * 2 + (y-x) * b
    print(min(s1,s2,s3))

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

Solution (Python):
a,b,c,x,y=[int(k) for k in raw_input().split(" ")]

print min(a*x+b*y, 2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y)), 2*c*max(x,y))

Solution (Python):
A,B,C,X,Y = map(int,input().split(" "))
m = min(X,Y)
ans = m * min((A+B),(C+C))
X -= m
Y -= m
if X != 0:
	ans += (min(A,C+C) * X)
else:
	ans += (min(B,C+C) * Y)

print(ans)

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

Solution (Python):
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

(A, B, C, X, Y) = reads()

ans = 0

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

print(ans)

Solution (Python):
a,b,c,x,y=map(int,input().split())
ret=10**10
for i in range(2*max(x,y)+1):
    aleft=max(x-(i//2),0)
    bleft=max(y-(i//2),0)
    ret=min(ret,c*i+aleft*a+bleft*b)
print(ret)

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

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

Solution (Python):


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

p1 = X * A + Y * B
m = min(X, Y)
p2 = m * 2 * C + (X - m) * A + (Y - m) * B
M = max(X, Y)
p3 = M * 2 * C

print(min(p1, p2, p3))

Solution (Python):
if __name__ == '__main__':
    a, b, c, x, y = map(int, input().split())
    cost = 10 ** 10
    for z in range(0, max(x, y) + 1):
        rx = max(0, x - z)
        ry = max(0, y - z)
        cost = min(cost, rx * a + ry * b + z * 2 * c)
    print(cost)

Solution (Python):

a, b, c, x, y = map(int, input().split())
answer = 0
if 2 * c < a + b:
    z = min(x, y)
    x -= z
    y -= z
    answer += 2 * c * z
a = min(a, 2 * c)
b = min(b, 2 * c)
answer += a * x
answer += b * y
print(answer)