peterverebics/CodeNet_Python_118 huggingface dataset:
A, B, C, X, Y = map(int, input().split())

ans = float("inf")
for i in range(max(X, Y)+1):
    x = max(X - i, 0)
    y = max(Y - i, 0)
    cost = 2*C * i + A * x + B * y
    ans = min(ans, cost)

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

ans = float('inf')

for i in range(2 * 10**5 + 1):
    ans = min(ans, a * max(x - i, 0) + b * max(y - i, 0) + 2 * c * i)

print(ans)
## C - Half and Half
import math
A, B, C, X, Y = map(int, input().split())
money = []
for i in range(0, max(X,Y) + 1 ):
    val = 0
    val += A * (X - i) if X - i > 0 else 0
    val += B * (Y - i) if Y - i > 0 else 0
    money.append(  val + C * 2*i )
print(min(money))
def LI():return map(int,input().split())
def I(): return input().split()

a,b,c,x,y=LI()
lst=0
ans=float("inf")
for i in range(10**5+1):
    ans=min(ans,(2*i*c+max(0,x-i)*a+max(0,y-i)*b))
print(ans)
import sys
import math
import collections
from collections import deque
from functools import reduce
import heapq
#n = int(input())
a, b, c, x, y = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

n = max(x, y)
ans = 10 ** 10
for i in range(n+1):
    p = max(x - i, 0)
    q = max(y - i, 0)
    r = 2 * i * c + p * a + q * b
    if r < ans:
        ans = r

print(ans)
a,b,c,x,y = map(int,input().split())
ans = 10**19
ans = min(ans,a*x+b*y)
ans = min(ans,c*max(x,y)*2)
if x <= y:
    ans = min(ans,c*x*2+(y-x)*b)
else:
    ans = min(ans,c*y*2+(x-y)*a)
print(ans)
a,b,c,x,y=map(int,input().split())
cost=0
val=min(x,y)
x-=val
y-=val
if a+b>=2*c:
    cost+=val*2*c
else:
    cost+=val*a
    cost+=val*b
if x:
    cost+=x*min(a,2*c)
if y:
    cost+=y*min(b,2*c)
print(cost)
I = [int(i) for i in input().split()]
A, B, AB, X, Y = I

ans = 1e+15
for i in range(max(X,Y)+1):
  price = A*max(X-i, 0) + B*max(Y-i, 0) + AB*2*i
  ans = min(ans, price)
print(ans)
A,B,C,X,Y = map(int,input().split())
c = []
for i in range(10 ** 5 + 1):
  cash = 2 * C * i + A * max(0,X - i) + B * max(0, Y - i)
  c.append(cash)
print(min(c))
a,b,c,x,y = map(int, open(0).read().split())

ans = 1 << 31

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

print(ans)
A, B, C, X, Y = map(int, input().split())
C *= 2
t,s,P = 0,max(X,Y),1000000000000
while s>=0:
  P = min(P, C*s+A*max(X-s, 0)+B*max(Y-s, 0))
  s -= 1
print(P)
def main():
    a,b,ab,ac,bc = map(int,input().split())
    price = 0
    if a+b < ab*2:
        price = a*ac + b*bc
    else:
        if ac < bc:
            price += ab*ac*2
            x = bc-ac
            price += min(x*b, x*ab*2)
        else:
            price += ab*bc*2
            x = ac-bc
            price += min(x*a, x*ab*2)
    print(price)

if __name__ == "__main__":
    main()
import sys
import time
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    A,B,C,X,Y = map(int, readline().split())
    Z = min(X, Y)
    if A + B >= C * 2:
        ans = min(C * Z * 2 + A * (X - Z) + B * (Y - Z), C * max(X, Y) * 2)
    else:
        ans = A * X + B * Y
    print(ans)

if __name__ == '__main__':
    main()
def solve():
    A, B, C, X, Y = map(int, input().split())
    C *= 2

    mn = float('inf')
    for i in range(max(X,Y)+1):
        price = 0
        price += C * i
        if Y - i > 0:
            price += B * (Y - i)
        
        if X - i > 0:
            price += A * (X - i)
        
        mn = min(price, mn)
    
    print(mn)

if __name__ == '__main__':
    solve()
# C - Half and Half

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

ans = A*X + B*Y
if A+B > C*2:
    m = min(X, Y)
    ans -= (A+B-(C*2)) * m
    X -= m
    Y -= m
if X > 0 and A > C*2:
    ans -= (A-(C*2)) * X
    Y -= X
if Y > 0 and B > C*2:
    ans -= (B-(C*2)) * Y
    Y -= Y

print(ans)
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    import math
    a,b,c,x,y=map(int, input().split())
    cmax=max(x,y)*2
    l=[]
    for i in range(cmax+1):
        amai = max(math.ceil(x - 0.5 * i),0)
        bmai = max(math.ceil(y - 0.5 * i),0)
        l.append(amai*a+bmai*b+i*c)
    print(min(l))
resolve()
import sys
sys.setrecursionlimit(10**9)
A, B, C, X, Y = map(int, input().split())

cost1 = A * X + B * Y
cost2 = max(X, Y) * 2 * C
if X <= Y:
    cost3 = X * 2 * C + (Y - X) * B
else:
    cost3 = Y * 2 * C + (X - Y) * A

print(min([cost1, cost2, cost3]))
a, b, c, x, y = map(int, input().split())

res1 = a * x + b * y

if x < y:
    res2 = c * x * 2 + b * (y - x)
else:
    res2 = c * y * 2 + a * (x - y)

res3 = c * max(x, y) * 2

res = min(res1, res2, res3)
print(res)
A, B, C, X, Y = map(int,input().split())

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

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

smallestSum = 0
tempSum = 0

smallestSum = a * x + b * y

if x < y:
	tempSum = c * x * 2 + b * (y - x)
	if tempSum < smallestSum:
		smallestSum = tempSum
	tempSum = c * y * 2
	if tempSum < smallestSum:
		smallestSum = tempSum
else:
	tempSum = c * y * 2 + a * (x - y)
	if tempSum < smallestSum:
		smallestSum = tempSum
	tempSum = c * x * 2
	if tempSum < smallestSum:
		smallestSum = tempSum

print(smallestSum)
a,b,ab,x,y=map(int,input().split())

if x<y:
    #print((y-x)*b+x*ab*2)
    print(min((y-x)*b+x*ab*2 , a*x+b*y , y*ab*2))
else:#x>=y
    #print((x-y)*a+y*ab*2)
    print(min((x-y)*a+y*ab*2,a*x+b*y , x*ab*2))
# pattern1:Only A-pizza/B-pizza
# pattern2:Only C-pizza
# pattern2:C-pizza & A or B-pizza

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

price1 = x * a + y * b
price2 = max(x, y) * 2 * c
price3 = min(x, y) * 2 * c + a * (x - min(x, y)) + b * (y - (min(x, y)))
print(min(price1, price2, price3))
A,B,C,X,Y=map(int, input().split())

if X>=Y:ans,Ccnt=C*X*2,X*2
else:ans,Ccnt=C*Y*2,Y*2

for c in range(1,Ccnt//2+1):
	
	temp=(Ccnt-2*c)*C
	if (Ccnt-c*2)//2<Y:
		temp+=(Y-(Ccnt-c*2)//2)*B
	if (Ccnt-c*2)/2<X:
		temp+=(X-(Ccnt-c*2)//2)*A
	#print(X-(Ccnt-c*2)/2,Y-(Ccnt-c*2)/2,Ccnt-2*c,temp)
	ans=min(ans,temp)

print(ans)
A,B,C,X,Y = map(int,input().split())
if A+B < C*2:
    print(A*X+B*Y)
elif X > Y:
    if A < C*2:
        print(Y*C*2+(X-Y)*A)
    else:
        print(X*C*2)
else:
    if B < C*2:
        print(X*C*2+(Y-X)*B)
    else:
        print(Y*C*2)
a, b, c, x, y = map(int, input().split())
ans = min(x*a+y*b, max(x,y)*c*2)
if x>y: ans = min(ans, y*c*2+(x-y)*a)
else: ans = min(ans, x*c*2+(y-x)*b)
print(ans)
A, B, C, X, Y = map(int, input().split())

C *= 2
ans = 0
if A + B <= C:
    ans += A * X + B * Y
else:
    min_num = min(X, Y)
    ans += min_num * C
    X -= min_num
    Y -= min_num
    if X > 0:
        if A > C:
            ans += X * C
        else:
            ans += X * A
    if Y > 0:
        if B > C:
            ans += Y * C
        else:
            ans += Y * B
print(ans)
a,b,c,x,y=map(int,input().split())
#A,Bをそれぞれ買う
cand1=a*x+b*y
#すべてABピザでそろえる
cand2=2*c*max(x,y)
#A,Bのうち必要枚数が少ないほうをすべてABピザで作る
cand3=2*c*x+b*(y-x) if x<y else 2*c*y+a*(x-y)
print(min(cand1,cand2,cand3))
a,b,c,x,y = map(int,input().split())
ans = 0
if a+b > 2*c:
	ans = c*2*min(x,y)
	if x<y:
		if b > 2 * c:
			ans += 2*c*(y-x)
		else:
			ans += b*(y-x)
	else:
		if a > 2 * c:
			ans += 2*c*(x-y)
		else:
			ans += a*(x-y)
else:
	ans = a*x+b*y	
print(ans)
A, B, C, X, Y = map(int, input().split())

res = float("inf")

for i in range(0, max(X, Y) * 2 + 1, 2):
    Amai = max(0, X - i // 2)
    Bmai = max(0, Y - i // 2)
    res = min(res, A * Amai + B * Bmai + C * i)

print(res)
A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for ab in range(0, 2 * (max(X, Y) + 1), 2):
  cost = ab * C + max(0, (X - ab // 2)) * A + max(0, (Y - ab // 2)) * B
  ans = min(ans, cost)
print(ans)
A,B,C,X,Y=map(int,input().split())

ans = A*X + B*Y
tmp = A*X + B*Y
x = X
y = Y
z = 0

while x >= 0 or y >= 0:
    tmp = A*max(0,x) + B*max(0,y) + C*z
    ans = min(ans,tmp)
    x=x-1
    y=y-1
    z=z+2

print(ans)
a, b, c, x, y = map(int, input().split())
m = min(x, y)
M = max(x, y)
p = a * x + b * y
q = c*m*2 + a*(x-m) + b*(y-m)
r = c*M*2
print(min(p, q, r))
A,B,C,X,Y = map(int,input().split())
if A+B>=2*C:
    ans = 2*C*min(X,Y)
    if X>=Y:
        ans += (X-Y)*min(A,2*C)
    else:
        ans += (Y-X)*min(B,2*C)
else:
    ans = (A+B)*min(X,Y)
    if X>=Y:
        ans += (X-Y)*A
    else:
        ans += (Y-X)*B
print(ans)
a, b, c, x, y = map(int, input().split())
#a, b, c, x, y = 1500, 2000, 500, 90000, 100000
#na, nb, nc = x, y, 0
mx = 10**18
for i in range(0, max(x,y)*2+1):
  if i%2==1: continue
  total = max(a*(x-i//2), 0) + max(b*(y-i//2), 0) + c*i
  if total<mx:
    mx=total

print(mx)
a,b,c,x,y = map(int,input().split())
ans = float("inf")
for i in range(max(x,y)+1):
    ans = min(ans, 2*c*i+max(0,x-i)*a+max(0,y-i)*b)
print(ans)
# https://atcoder.jp/contests/abc095/tasks/arc096

# 値段,枚数
A, B, C, X, Y = map(int, input().split())

# C * 2 は　A + Bとなる
ans = max(X, Y) * 2 * C

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

elif Y > X:
    ans = min(ans, (Y - X) * B + 2 * C * X)

print(ans)
A,B,C,X,Y = [int(i) for i in input().split()]
if A + B < C * 2:
    print(A*X + B*Y)
else:
    p1 = min(X,Y) * C * 2 + (X - min(X,Y))*A + (Y - min(X,Y))*B
    p2 = max(X,Y) * C * 2
    print(min(p1, p2))
a, b, c, x, y = map(int,input().split())
res = min(a*x + b*y, max(x, y) * 2 * c)

if x < y:
    temp = x * 2 * c + (y - x) * b
else:
    temp = y * 2 * c + (x - y) * a

print(min(res, temp))
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*x*2+b*(y-x), 2*y*c))
    else:
        print(min(a*(x-y)+c*y*2, 2*x*c))
A,B,C,X,Y = map(int,input().split())
ans = float('inf')
for c in range(max(X,Y) + 1):
    tmp = c*2*C
    tmp += max(0,X-c)*A
    tmp += max(0,Y-c)*B
    ans = min(ans, tmp)
print(ans)
A,B,C,X,Y=[int(x) for x in input().split(' ')]

cmin=max([X,Y])
lis=[]
for i in range(cmin+1):
	i_c=i*2
	i_a, i_b=X-i,Y-i
	# print(i_a,i_b,i_c)
	if i_a>=0 and i_b>=0:
		lis.append(i_c*C+i_b*B+i_a*A)
	if i_a<0:
		if i_b<0:
			lis.append(i_c*C)
		else:
			lis.append(i_c*C+i_b*B)
	elif i_b<0:
		lis.append(i_c*C+i_a*A)


print(min(lis))
pa, pb, pab, na, nb = map(int, input().split())

'''
1. そのまま
2. 少ない方全てをabで

3. abいっぱいで余らせる
'''

ans1 = pa * na + pb * nb
ans2 = pab * min(na, nb) * 2 + (pa if(na > nb) else pb) * abs(na - nb)
ans3 = pab * max(na, nb) * 2

print(min(ans1, ans2, ans3))
a,b,c,x,y = map(int, input().split())
ans = 10**12
for i in range(0, (max(x,y)*2)+1, 2):
    xr = max(x-(i//2), 0)
    yr = max(0, y-(i//2))

    if ans > (i*c)+(xr*a)+(yr*b):
        ans = (i*c)+(xr*a)+(yr*b)

print(ans)
A,B,C,X,Y = map(int,input().split())
ans = 100000000000000000000000000000000000000
for c in range (0,100001):
  price = A*max(0,X-c)+B*max(0,Y-c)+C*2*c
  if price < ans:
    ans = price
print(int(ans))
A, B, C, X, Y = map(int, input().split())
ans = None
for ab_count in range(0, max(X, Y) * 2 + 1, 2):
    a_count = max(0, X - ab_count // 2)
    b_count = max(0, Y - ab_count // 2)
    amount = a_count * A + b_count * B + ab_count * C
    if ans is None:
        ans = amount
    else:
        ans = min(ans, amount)
print(ans)
A,B,C,X,Y = map(int,input().split())
if X-Y>=0:
    print(min(A*X+B*Y,A*(X-Y)+C*2*Y,C*2*X))
else:
    print(min(A*X+B*Y,B*(Y-X)+C*2*X,C*2*Y))
A, B, C, X, Y = map(int, input().split())

mini = float('inf')

for i in range(10**6 + 1):
    calc = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
    if calc < mini:
        mini = calc

print(mini)
a,b,c,x,y = map(int,input().split())
ab = c*2 #A,B１枚ずつ入手
if ab <= a+b:
    bab = min(x,y)*ab
    if x > y:
        bother = (max(x,y)-min(x,y))*a
    else:
        bother = (max(x,y)-min(x,y))*b
    ans = min(bab+bother,ab*max(x,y))
else:
    bab = 0
    bother = a*x + b*y
    ans = bab + bother
print(ans)
A,B,C,X,Y = map(int,input().split())
if A + B < 2 * C:
    ans = A * X + B * Y
else:
    ans = min(X,Y) * 2 * C
    if X < Y:
        Z = Y - X
        ans += Z * min(B,2*C)
    else:
        Z = X - Y 
        ans += Z * min(A,2*C)
print(ans)
A,B,C,X,Y=map(int,input().split())

ans=10**9

my_min=min(X,Y)
my_max=max(X,Y)

ans1=2*C*my_min+A*(X-my_min)+B*(Y-my_min)
ans2=2*C*my_max
ans3=A*X+B*Y
print(min(ans1,ans2,ans3))
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = "Yes"
no = "No"

def main():
    a,b,c,x,y = mi()
    ans = 1<<60
    for i in range(max(x,y)+1):
        ans = min(max(x-i,0)*a+max(y-i,0)*b+2*i*c,ans)
    print(ans)


main()
#n = int(input())
a,b,c,x,y = map(int,input().split())
#a_L = list(map(int,input().split()))
price = float("inf")
for i in range(10**7):
    price = min(price,i*2*c + max(0,x-i)*a +  max(0,y-i)*b)

print(price)
a,b,c,x,y=list(map(int,input().split()))
money=a*x+b*y

for i in range(max(2*x+1,2*y+1)):
    a_money=max(a*(x-i),0)
    b_money=max(b*(y-i),0)
    money=min(money,a_money+b_money+i*c*2)

print(money)
A,B,C,X,Y = input().split(' ')

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

ans = 10 ** 12
for i in range(0,100001):
  tmp = int(C) * 2 * i + int(A) * max(int(X)-i,0) + int(B) * max(int(Y)-i,0)
  ans = min(ans,tmp)

print(ans)
# solution

import io
import sys

a, b, c, x, y = map(int, input().split())
print(min([a*x+b*y, a*(x-min([x,y]))+b*(y-min([x,y]))+2*c*min([x,y]),2*c*max([x, y])]))
#!/usr/bin/env python3
a, b, c, x, y = map(int, input().split())
print(
    min(
        a * x + b * y,
        max(x, y) * c * 2,
        c * x * 2 + (y - x) * b if y > x else c * y * 2 + (x - y) * a if x > y else 10**9,
    ))
A, B, C, X, Y = [int(i) for i in input().split()]
if X < Y:
    ans = X*C*2+(Y-X)*B
else:
    ans = Y*C*2+(X-Y)*A
ans = min(A*X+B*Y, max(X, Y)*C*2, ans)
print(ans)
a, b, c, x, y = map(int, input().split())

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

q = a*x + b*y
r = 2*c * max(x, y)

print(min(p, q, r))
A, B, C, X, Y = map(int, input().split())
ans = float("inf")

for i in range(max(X,Y)+1):
    total = A*(X-min(X,i)) + B*(Y-min(Y,i)) + C*2*i

    if ans > total:
        ans = total

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

if (a+b) > c*2:
  tmp = min(x,y)
  if x > y:
    print(min(c*2*tmp + a*(x-y), c*2*x))
  else:
    print(min(c*2*tmp + b*(y-x), c*2*y))
else:
  print(a*x + b* y)
a,b,c,x,y=map(int,input().split())
m=10**10
for i in range(2*(x+y)+1):
  m=min(m,max(0,x-i//2)*a+max(0,y-i//2)*b+i*c)
print(m)
a,b,c,x,y = map(int, input().split())
c*=2
ans = min (a*x+b*y,c*max(x,y))
if x<y:
    ans = min(c*x+(y-x)*b,ans)
else:
    ans = min(c*y+(x-y)*a,ans)
print(ans)
A, B, C, X, Y = map(int, input().split())
if A + B > 2 * C:
    a = min(X, Y)
    c = a * 2 * C
    if a == Y:
        if A > 2 * C:
            print(c + 2 * C * (X - a))
        else:
            print(c + (X - a) * A)
    else:
        if B > 2 * C:
            print(c + 2 * C * (Y - a))
        else:
            print(c + (Y - a) * B)
else:
    print(A * X + B * Y)
a, b, c, x, y = map(int, input().split())
if (a + b) / 2 < c:
    print(a*x + b*y)
else:
    ans = c * min(x, y) * 2
    if x > y:
        if a < c * 2:
            ans += a * (x - y)
        else:
            ans += c * 2 * (x - y)
    else:
        if b < c * 2:
            ans += b * (y - x)
        else:
            ans += c * 2 * (y - x)
    print(ans)
a,b,c,x,y = list(map(int, input().split()))

c = 2*c

ans = a * x + b *y
for i in range(1, max(x, y)+1):
    _ans = c * i + a * max(x-i, 0) + b * max(y-i, 0)
    ans = min(ans, _ans)
print(ans)
A,B,C,X,Y=map(int,input().split())
if Y<X:
    A,B=B,A
    X,Y=Y,X
print(min(2*C,A+B)*X+min(2*C,B)*(Y-X))
a, b, c, x, y = map(int, input().split())

# 購入金額
price_a_b = 0
price_mix = 0
price_c = 0

# Aピザ、BピザをそれぞれX,Y枚購入する
price_a_b = a*x + b*y

# ABピザを、MIN(X,Y)*2枚購入し、Aピザ、Bピザどちらかの不足分を購入する
price_mix = c*min(x, y)*2 + a*(x-min(x, y)) + b*(y-min(x, y))

# ABピザをMAX(X,Y)枚購入する
price_c = c*max(x, y)*2

print(min(price_a_b, price_mix, price_c))
A, B, C, X, Y = list(map(int, input().split()))
if X == Y:
    print(min(A + B, 2 * C) * X)
elif X < Y:
    print(min(A + B, 2 * C) * X + min(B, 2 * C) * (Y - X))
else:
    print(min(A + B, 2 * C) * Y + min(A, 2 * C) * (X - Y))
A,B,C,X,Y=map(int,input().split())
ans=10**10
Z=max(X,Y)
for i in range(0, Z+1):
    tmp=C*i*2
    if X-i>=0:
        tmp+=A*(X-i)
    if Y-i>=0:
        tmp+=B*(Y-i)
    ans=min(ans,tmp)
print(ans)
a,b,c,x,y=map(int,input().split())
c=c*2
print(min(c*max(x,y),y*c+max(x-y,0)*a,x*c+max(y-x,0)*b,a*x+b*y))
def main():
    a, b, c, x, y = map(int, input().split())
    p = {x: a, y: b}
    print(min(a * x + b * y, c * max(x, y) * 2, c * min(x, y) * 2 + (max(x, y) - min(x, y)) * p[max(x, y)]))


if __name__ == '__main__':
    main()
# coding:UTF-8
import sys
from math import factorial

MOD = 10 ** 9 + 7
INF = float('inf')

A, B, C, X, Y = list(map(int, input().split()))     # スペース区切り連続数字

mcost = INF

cnum = max(X, Y)
for i in range(cnum+1):
    anum = max(0, (X - i))
    bnum = max(0, (Y - i))
    cost = A * anum + B * bnum + C * i * 2
    mcost = min(mcost, cost)

print("{}".format(mcost))
#C
a, b, c, x, y = map(int,input().split())
ans = 10**10
for i in range(10**5+1):
    ans = min(ans,2*c*i + a*max(0,x-i) + b*max(0,y-i))
print(ans)
A, B, C, X, Y = map(int, input().split())
ans = 0
if A + B < 2 * C:
  print(A * X + B * Y)
else:
  while X > 0 and Y > 0:
    ans += 2 * C
    X -= 1
    Y -= 1  
  if A > 2 * C:
    A = 2 * C
  if B > 2 * C:
    B = 2 * C
  print(ans + A * X + B * Y)
a,b,c,x,y=map(int, input().split())
max_=max(x,y)
cost=100000000000
for i in range(max_+1):
  cost_=i*2*c+a*max(0,x-i)+b*max(0,y-i)
  cost=min(cost_,cost)
print(cost)
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial
from bisect import bisect_left # bisect_left(list, value)
#from fractions import gcd

sys.setrecursionlimit(10**7)
A, B, C, X, Y = map(int, input().split())

val1 = A*X + B*Y
minXY = min(X, Y)
val2 = C*2*minXY + A*(X-minXY) + B*(Y-minXY)
maxXY = max(X, Y)
val3 = C*2*maxXY

print(min(val1, val2, val3))
a,b,c,x,y = map(int,input().split())
plan1 = a*x+b*y
plan2 = c*max(x,y)*2
plan3 = c*x*2+b*(y-x) if x<y else c*y*2+a*(x-y)
print(min(plan1,plan2,plan3))
A,B,C,X,Y = map(int,input().split())
C*=2
minxy = min(X,Y)
maxxy = max(X,Y)
ans1 = C * minxy + A * (X-minxy) + B * (Y-minxy)
ans2 = A*X + B*Y
ans3 = C * maxxy
print (min(ans1,ans2,ans3))
piza = list(map(int,input().split()))
x = piza[0] * piza[3] + piza[1] * piza[4]
y = piza[2] * 2 * max(piza[3],piza[4])
if piza[3] >= piza[4]:
	z = piza[2] * (2 * piza[4]) + piza[0]*(piza[3]-piza[4])
else:
	z = piza[2] * (2 * piza[3]) + piza[1]*(piza[4]-piza[3])
print(min(x,y,z))
# AtCoder Beginner Contest 095 C - Half and Half
import sys

A, B, C, X, Y = map(int, sys.stdin.readline().strip().split())

"""
ans = A * X + B * Y
for z in range(2, 2 * 10 ** 5 + 1, 2):
    x = max(X - int(z / 2), 0)
    y = max(Y - int(z / 2), 0)

    price = A * x + B * y + C * z
    ans = min(price, ans)

print(ans)
"""

price1 = A * X + B * Y
price2 = C * 2 * X + B * max(Y - X, 0)
price3 = A * max(X - Y, 0) + C * 2 * Y
print(min(price1, price2, price3))
A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(max(X,Y)+1):
    cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B
    ans = min(ans,cost)
print(ans)
a,b,c,x,y=map(int,input().split())

res1=a*x+b*y
if x>y:
    res2=2*y*c+(x-y)*a
else:
    res2=2*x*c+(y-x)*b
res3=2*max(x,y)*c
print(min(res1,res2,res3))
A,B,C,X,Y = map(int,input().split())

CtoAB1 =0
CtoAB2 =0
AandB =0

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

AandB=A*X+B*Y

print(min(CtoAB1,CtoAB2,AandB))
A, B, C, X, Y = map(int, input().split())

if A+B <= 2*C:
    ans = X*A + Y*B
else:
    z = min(X, Y)
    if z == X:
        c = B
    else:
        c = A
    ans = C*2*z
    Z = max(X, Y) - z
    if c <= 2*C:
        ans += c*Z
    else:
        ans += 2*C*Z
    
print(ans)
a,b,c,x,y=map(int,input().split())
print(min(a*max(0,(x-i))+b*max(0,(y-i))+2*c*i for i in range(max(x,y)+1)))
A, B, C, X, Y = map(int, input().split())

ans = 10**18
for i in range(0, 2*max(X, Y)+2, 2):
    ans = min(ans, i * C + max(X-(i//2), 0) * A + max(Y-(i//2), 0) * B)
print(ans)
#!/usr/bin/env python
import math

def main():
    A, B, C, X, Y = map(int, input().split())
    ans = float("inf")
    for k in range(2 * max(X, Y) + 1):
        i = max(0, math.ceil(X - 0.5 * k))
        j = max(0, math.ceil(Y - 0.5 * k))
        total = A * i + B * j + C * k
        if ans > total:
            ans = total
    print(ans)

if __name__ == '__main__':
    main()
a, b, c, x, y = map(int, input().split())
ans = 10 ** 18
for i in range(10 ** 5 * 2):
    ans = min(ans, i * 2 * c + max(0, x - i) * a + max(0, y - i) * b)
print(ans)
A,B,C,X,Y=map(int,input().split())
print(min(min(2*C*max(X,Y),A*X+B*Y),min(2*C*X+B*max(Y-X,0),A*max(X-Y,0)+2*C*Y)))
A, B, C, X, Y = map(int, input().split())

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

print(ans)
a,b,c,x,y = map(int, input().split())
ans = a*x + b*y
for i in range(1, max(x,y)+1):
    if (max((x-i),0)*a + max((y-i),0)*b + c*2*i) < ans:
        ans = (max((x-i),0)*a + max((y-i),0)*b + c*2*i)
print(ans)
A,B,C,X,Y = list(map(int,input().split()))
if A+B <= 2*C:
    print(A*X+B*Y)
    exit()
if X == Y:
    print(2*C*X)
elif X > Y:
    tmp = 2*C*Y
    X -= Y
    m = min(2*C*X,A*X)
    print(tmp+m)
else:
    tmp = 2*C*X
    Y -= X
    m = min(2*C*Y,B*Y)
    print(tmp+m)
a,b,c,x,y = map(int,input().split())
if a+b<=2*c:
    print(a*x+b*y)
else:
    if x<=y:
        print(2*c*x+min(b,2*c)*abs(y-x))
    else:
        print(2*c*y+min(a,2*c)*abs(y-x))
a,b,c,x,y=map(int,input().split())
ans=min(a*x+b*y,2*c*x+b*max(0,y-x),2*c*y+a*max(0,x-y))
print(ans)
A,B,C,X,Y = map(int,input().split())
x = 0
y = 0
pay = 0
if X == Y:
  pay = min(A*X+B*Y,2*C*X)
elif X > Y:
  pay = min(A*X+B*Y,2*C*Y+A*(X-Y),2*C*X)
else:
  pay = min(A*X+B*Y,2*C*X+B*(Y-X),2*C*Y)
print(pay)
A, B, C, X, Y = map(int, input().split())
ret = A * X + B * Y
x = 0
y = 0
c = 0
while (X + Y) * 2 > c :
    c += 2
    x += 1
    y += 1
    tmp = A * max(0, X - x) + B * max(0, Y - y) + c * C
    ret = min(ret, tmp)
print(ret)
a, b, c, x, y = map(int, input().split())
ab = c*2
if a+b > ab:
    t = ab*min(x,y)
    d = max(x,y)-min(x,y)
    if x>y: dd = a*d
    else: dd = b*d
    print(t+ab*d if dd>ab*d else t+dd)
else:
    print(a*x+b*y)
a, b, c, x, y = map(int, input().split())
each = 0
if x==y:
    each = 0
elif x>y:
    each = min(a, 2*c)*(x-y)
else:
    each = min(b, 2*c)*(y-x)

print(min(min(x, y)*2*c+each, min(a, 2*c)*x + min(b, 2*c)*y))
a, b, c, x, y = map(int, input().split())
pmin = 10**10
for i in range(0, 2*max(x, y)+1, 2): # i枚のABピザを買う
    bx = max(0, x - i//2)
    by = max(0, y - i//2)
    pay = a*bx + b*by + c*i
    pmin = min(pmin, pay)


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

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

else:
    C_num = min(X, Y)
    print(min(2*C*max(X, Y), C_num*2*C + A*(X-C_num) + B*(Y-C_num)))
a,b,c,x,y=map(int,input().split())
z=min(x,y)
sm=min((a+b)*z,c*2*z)
if x>z: sm+=min(a,2*c)*(x-z)
else : sm+=min(b,2*c)*(y-z)
print(sm)
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a, b, c, x, y = map(int, input().split())
    lim = max(x, y)
    ans = 10**12
    for i in range(lim+1):
        price = a*max(0, x-i) + b*max(0, y-i) + c*2*i
        ans = min(ans, price)
    print(ans)

if __name__ == '__main__':
    main()
A, B, C, X, Y = map(int, input().split())
ans = A * X + B * Y
for z in range(0, 2*max(X, Y)+1, 2):
    a = C*z + A * max(0,X - z//2) + B * max(0, Y - z//2)
    ans = min(ans, a)
print(ans)
A, B, C, X, Y = list(map(int, input().split()))

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

print(min(min(a,b),c))