"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-----
1500 2000 1600 3 2

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

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

if (a + b) <= 2 * c:
  print((a * x + b * y))
else:
  max_c = max(x,y)
  min_c = min(x,y)
  AB = 2 * c * max_c
  if x > y:
    SP = ((x - min_c) * a) + (2 * c * min_c)
  else:
    SP = ((y - min_c) * b) + (2 * c * min_c)
  print((min(AB,SP)))


A, B, C, X, Y = map(int, input().split())
ans = float('INF')
for k in range(0, 2*max(X, Y)+1, 2):
  i = max(0, X - int(k/2))
  j = max(0, Y - int(k/2))
  ans = min(ans, A*i + B*j + C*k)
print(ans)

# import itertools
# import math
# from functools import reduce
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
A, B, C, X, Y = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

# def gcd_list(numbers):
#     return reduce(math.gcd, numbers)

# if gcd_list(A) > 1:
#     print("not coprime")
#     return

# 高速素因数分解準備
#MAXN = 10**6+10
#sieve = [i for i in range(MAXN+1)]
#p = 2
#while p*p <= MAXN:
#    if sieve[p] == p:
#        for q in range(2*p, MAXN+1, p):
#            if sieve[q] == q:
#                sieve[q] = p
#    p += 1

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

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


import sys

input = sys.stdin.readline
a, b, c, x, y= map(int, input().split())
ab = 2*c
count_x = 0
count_y = 0
buy_a = 0
buy_b = 0
buy_c = 0

if ab < a+b:
    min_count = min(x,y)
    count_x = min_count
    count_y = min_count
    buy_c = 2*min_count
    if x - count_x > 0:
        if ab > a:
            buy_a += x - count_x
        else:
            buy_c += 2 * (x - count_x)
    
    elif y - count_y > 0:
        if ab > b:
            buy_b += y - count_y
        else:
            buy_c += 2*(y - count_y)
else:
    min_count = min(x,y)
    if min_count == x:
        buy_a = min_count
        if ab > b:
            buy_b += y
        else:
            buy_c += 2 * y
    else:
        buy_b = min_count
        if ab > a:
            buy_a += x
        else:
            buy_c += 2 * x

print(buy_a * a + buy_b * b + buy_c * c)

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

result = []

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

print((min(result)))


a,b,c,X,Y = map(int,input().split())

min1 = 10**10
for z in range(0,200001,2):
    x = max(0,X-z//2)
    y = max(0,Y-z//2)
    min1 = min(min1,a*x + b*y + c*z)

print(min1)

def LI():
    return list(map(int, input().split()))
a,b,c,x,y = LI()


ans = float('INF')

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

print(ans)

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

ans1 = x * a + y * b

min_xy = min(x, y)
ans2 = min_xy * 2 * c + (x - min_xy) * a + (y - min_xy) * b

max_xy = max(x, y)
ans3 = max_xy * 2 * c

print(min(ans1, ans2, ans3))

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

ans =0

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

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

mast = max(x,y)
ans = float('INF')

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

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

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

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

print(cost)

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

A_B = (a*x)+(b*y)
AB = 2*c*max(x, y)

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

print(min(A_B, AB, C))

#!/usr/bin/env python3

def II(): return int(input())
def MII(): return list(map(int, input().split()))
def LII(): return list(map(int, input().split()))

def main():
    A, B, C, X, Y = MII()

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

    print(ans)

def __starting_point():
    main()

__starting_point()

import math

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

ans = A * X + B * Y

if (A + B) / 2 < C:
    pass
else:
    for i in range(max(X * 2, Y * 2)+1):
        j = max(0, X - int(i / 2))
        k = max(0, Y - int(i / 2))

        ans = min(ans, i * C + j * A + k * B)

print(ans)

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

a, b, c, x, y = map(int, input().split())
n = a * x + b * y
m = 2 * c * max(x, y)

p = b if x < y else a
l = 2 * c * min(x, y) + p * abs(x-y)

ans = min(n, min(m, l))
print(ans)

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


moneys=[]
for i in range(0,max(x,y)*2+1,2):
    apizza=x-int(i/2)
    bpizza=y-int(i/2)
    if apizza<0:
        apizza=0
    if bpizza<0:
        bpizza=0
    money=apizza*a+bpizza*b+i*c
    moneys.append(money)

print((min(moneys)))


a_price,b_price,ab_price,num_a,num_b = list(map(int, input().split()))
total = 0

if a_price + b_price < 2 * ab_price:
	total = a_price * num_a + b_price * num_b

elif a_price + b_price >= 2 * ab_price:
	if num_a >= num_b:
		if a_price > ab_price * 2:
			total = ab_price * 2 * num_a
		else:
			total = ab_price * 2 * num_b + a_price * (num_a - num_b)
	else:
		if b_price > ab_price * 2:
			total = ab_price * 2 * num_b
		else:
			total = ab_price * 2 * num_a + b_price * (num_b - num_a)

print(total)



A,B,C,X,Y = map(int,input().split())
sumAB = A+B
if sumAB >= 2*C:
    minXY = min(X,Y)
    ans = min(X,Y)*2*C
    X -= minXY
    Y -= minXY
    if X != 0:
        ans += X*min(A,2*C)
    elif Y !=0:
        ans += Y*min(B,2*C)
    print(ans)

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

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

def slove():
    A,B,C,X,Y = map(int,input().split())
    """
    possible combinations are below.
        A * x + B * y   
        if x < y: B * abs(x-y) + C * min(x,y) * 2
        if x > y: A * abs(x-y) + C * min(x,y) * 2
        C * max(x,y) * 2
    """
    ans1 = A * X + B * Y
    if X<Y:
        ans2 = B * abs(X-Y) + C * 2 * min(X,Y)
    else:
        ans2 = A * abs(X-Y) + C * 2 * min(X,Y)
    
    ans3 = C * 2 * max(X,Y)
    print(min(ans1,ans2,ans3)) 

def __starting_point():
    slove()
__starting_point()


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

ans1 = (2*C)*min(X,Y) + A*(X-min(X,Y)) + B*(Y-min(X,Y))
ans2 = A*X + B*Y
ans3 = 2*C*max(X,Y)

ans = min(ans1,ans2,ans3)
print(ans)



###########コーディング
a, b, c, x, y = map(int,input().split())

n = a*x+b*y
m = c * 2 * max(x,y)
p = a if x>y else b
l = c*2*min(x,y)+p*abs(x-y)
ans = min(n,min(m,l))

print(ans)

l = list(map(int, input().split()))
A, B, C, X, Y = l[0], l[1], l[2], l[3], l[4]
s_1, s_2, s_3 = 0, 0, 0

s_1 = A*X + B*Y

maxv = max([X, Y])
s_2 = 2*C*max([X, Y])
if X >= Y:
    s_3 = 2*C*Y + A*(X-Y)
else:
    s_3 = 2*C*X + B*(Y-X)

print((min([s_1, s_2, s_3])))




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

ans = 0

ab_total =  (C*2) * max(X,Y)

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

if ab_total < ans:
    print(ab_total)
else:
    print(ans)





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

price = a * x + b * y


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

    price = min(price, cand)

print(price)
  


import math
a, b, c, x, y = list(map(int, input().split(' ')))
ans = float('inf')
c = c*2
for i in range(max(x, y)+1):
    ans = min(ans, a*max(0, x-i)+b*max(0,y-i)+c*i)
print(ans)


#n = int(input())
a, b, c, x, y = list(map(int, input().split()))
#al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]
mn = a*x+b*y
for i in range(0, max(x, y)+1):
    mn = min(mn, max(x-i, 0)*a+max(y-i, 0)*b+2*i*c)
print(mn)


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

for i in range(0,2*max(X,Y)+1,2):
  if X-i//2 >= 0 and Y-i//2 >= 0:
    moneys.append((X-i//2)*A + (Y-i//2)*B + C*i)
  elif X-i//2 >= 0 and Y-i//2 < 0:
    moneys.append((X-i//2)*A + C*i)
  elif X-i//2 < 0 and Y-i//2 >= 0:
    moneys.append((Y-i//2)*B + C*i)
  else:
    moneys.append(C*i)
    
print(min(moneys))

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

ans = 10 ** 9

for c in range(max(X, Y)+1):
    a = max(X - c, 0)
    b = max(Y - c, 0)

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

print(ans)

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

piza_min = min(x,y)

plan1 = c*piza_min*2 + a*(x-piza_min) + b*(y-piza_min)
plan2 = a*x + b*y
plan3 = c*max(x,y)*2

print(min(plan1,plan2,plan3))

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

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

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

m = min(x,y)
c2 = min(a+b, 2*c)
ans = c2*m
x -= m
y -= m
if x:
  ans += min(a, 2*c)*x
if y:
  ans += min(b, 2*c)*y
print(ans)


a,b,c,x,y = list(map(int, input().split()))
ans = int(1e9)
for i in range(max(x,y)*2+1):
    ans = min(ans, c*i+a*max(0, x-i//2)+b*max(0, y-i//2))

print(ans)


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

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


a, b, c, x, y = list(map(int, input().split()))
sum = a + b
if x > y:
    cost = a
else:
    cost = b


if sum > 2 * c:
    if x == y:
        total = 2 * x * c
        pass
    else:
        total = 2 * min(x, y) * c
        num = (max(x, y)-min(x, y))
        if cost * num < 2 * num * c:
            total += cost * num
        else:
            total += 2 * num * c

elif sum == 2 * c:
    if x == y:
        total = x * 2 * c
        pass
    else:
        total = min(x, y) * 2 * c
        num = (max(x, y)-min(x, y))
        if cost * num < 2 * c * num:
            total += cost * num
        else:
            total += num * 2 * c
else:
    total = a * x + b * y

print(total)


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

ans = [a * x + b * y]

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

print((min(ans)))


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

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

A,B,C,X,Y=map(int,input().split())
dpr=min(A+B,2*C)
Apr=min(A,2*C)
Bpr=min(B,2*C)

dam=dpr*min(X,Y)
if X>=Y:
  sam=Apr*(X-Y)
else:
  sam=Bpr*(Y-X)
  
print(dam+sam)

A, B, C, X, Y = map(int, input().split())
ans = 5000 * 1000000
for i in range(0, max(X, Y)*2 + 1, 2): 
        x = max(0, X - i//2)
        y = max(0, Y - i//2)
        ans = min(ans, A*x + B*y + C*i)
print(ans)

# C - Half and Half
A,B,C,X,Y = map(int,input().split())

# AB ピザを買わない場合
pay1 = X*A + Y*B
# A ピザ を AB ピザで作る場合
pay2 = 10**10
if Y >= X:
    pay2 = C*2*X + B*(Y-X)
# B ピザを AB ピザで作る場合
pay3 = 10**10
if X >= Y:
    pay3 = A*(X-Y) + C*2*Y
# AB ピザで全部作る場合
pay4 = C*max(X,Y)*2
print(min(pay1,pay2,pay3,pay4))

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

price = 0

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

d = max(X, Y) - min(X, Y)
if d != 0:
    if X > Y:
        price += min(A, C * 2) * d
    else:
        price += min(B, C * 2) * d

print(price)

3
#coding: utf-8

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

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

if X > 0:
    if A > C * 2:
        ret += X * C * 2
    else:
        ret += X * A

if Y > 0:
    if B > C * 2:
        ret += Y * C * 2
    else:
        ret += Y * B

print(ret)


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

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

if X <= Y:
  ans = X * ab + (Y - X) * b
else:
  ans = Y * ab + (X - Y) * a
print(ans)

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


a,b,c,x,y=map(int,input().split())
p = a*x + b*y
q = 2*c*max(x,y)
r = 2*c*x + b*(y-x)
s = 2*c*y + a*(x-y)
if x >=y:
        print(min(p,q,s))
else:
        print(min(p,q,r))

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

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


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

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

# -*- coding: utf-8 -*-

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

ans = 10000 * 10**5
for z in range(10**5+1):
    x = max(X-z, 0)
    y = max(Y-z, 0)
    yen = A*x + B*y + 2*C*z
    if ans > yen:
        ans = yen

print(ans)


a, b, c, x, y = map(int, input().split())
print(min(a*x+b*y, 2*c*x + b*max(0,y-x), 2*c*y + a*max(0, x-y)))

A, B, C, X, Y = map(int, input().split())
ans = float("inf")
for i in range(0, max(X, Y)*2 + 1, 2): 
        x = max(0, X - i//2)
        y = max(0, Y - i//2)
        ans = min(ans, A*x + B*y + C*i)
print(ans)

a,b,c,x,y = [int(x) for x in input().split()]
res = 0
if a + b > 2 * c:
  res += min(x,y) * 2 * c
  if x == min(x,y):
    if b > 2 * c:
      res += (y - min(x,y)) * 2 * c
    else:
      res += (y - min(x,y)) * b
  else:
    if a > 2 * c:
      res += (x - min(x,y)) * 2 * c
    else:
      res += (x - min(x,y)) * a
else:
  res += a * x
  res += b * y
print(res)

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


# C
A,B,C,X,Y = list(map(int,input().split()))
ans = 0
if 2*C >= A + B:
  ans = A*X+B*Y 
else:
  x = min(X,Y)
  ans = min(X,Y)*(2*C)
  if (X-x)*A + (Y-x)*B > (X+Y-2*x)*(2*C):
    ans += (X+Y-2*x)*(2*C)
  else:
    ans += (X-x)*A + (Y-x)*B
print(ans)


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

c = int(c*2)
m = float('inf')
for i in range(10**5+1):
    m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)
print(m)

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

mincost = a*x+b*y
for z in range(max(x,y)+1):
    x_ = max(0, x-z)
    y_ = max(0, y-z)
    cost = 2*c*z + a*x_ + b*y_
    mincost = min(mincost, cost)

print(mincost)


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

ab = a * x + b * y
cc = c * 2 * max(x, y)
abcc = c * 2 * min(x, y) + (b if x < y else a) * abs(x - y)

print(min(ab, cc, abcc))

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    a, b, c, x, y = Input()

    if a + b < c * 2:
        print(a * x + b * y)
        return

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


main()

A,B,C,X,Y =map(int,input().split())
res = 2 * C * max(X,Y)
if X > Y:
    res = min(2 * C * Y + (X-Y) * A,res)
else:
    res = min(2 * C * X + (Y-X) * B,res)
res = min(A*X+B*Y,res)

print(res)

a,b,c,x,y=map(int,input().split())
print(min(a*x+b*y,(max(x,y)*c*2),min(x,y)*c*2+max(0,x-min(x,y))*a+max(0,y-min(x,y))*b))

import math

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

min_sum = A*X+B*Y
for c in range(0, (max(X, Y)*2)+1, 2):
    s = (max(X-math.floor(c/2), 0))*A + (max(Y-math.floor(c/2), 0))*B + c*C
    if s < min_sum:
        min_sum = s
print(min_sum)


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

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

a, b, c, x, y = map(int,input().split())
ans = 1e10
for k in range(100010):
    ans = min(( 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b ),ans)
print(int(ans))

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

# set x >= y
if x < y: 
    x,y = y,x
    a,b = b,a

price_1 = a*x + b*y
price_2 = a*(x-y) + 2*c*y
price_3 = 2*c*x

print(min(price_1, price_2, price_3))

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

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

    res = min(res, cand)

print(res)

A,B,C,X,Y=map(int, input().split())
ans=A*X+B*Y
a=0
b=0

for i in range(1,1+2*max(X,Y)):
  if X-i/2<0:
    a=0
  else:
    a=X-i/2
  if Y-i/2<0:
    b=0
  else:
    b=Y-i/2
  ans = min(ans, A*a+B*b+C*i)
  
print(int(ans))

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

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

dif = abs(X - Y)
rem = max(X, Y)
if rem == X:
    E = A
else:
    E = B

com = rem - dif
ans = 0

D = A + B
if D < C * 2:
    ans += D * com
else:
    ans += C * com * 2

if E < C * 2:
    ans += E * dif
else:
    ans += C * dif * 2

print(ans)

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

a,b,c,x,y = map(int,input().split())
ans = 0
ab = min(a+b,c*2)
temp = min(x,y)
ans += ab*temp
x -= temp
y -= temp
ans += min(a,c*2)*x 
ans += min(b,c*2)*y
print(ans)

A, B, C, X, Y = list(map(int, input().split()))
ans = 10000000000
cost = 0

# C for both A and B
cost = max(X, Y) * C * 2
ans = min(ans, cost)

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

cost = A * X + B * Y
ans = min(ans, cost)

print(ans)

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

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

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

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    a,b,c,x,y = map(int,input().split())
    ans1=99999999999999999999999999
    if a+b>2*c:
        if x > y:
            ans1=2*c*y+a*(x-y)
        elif y > x:
            ans1=2*c*x+b*(y-x)
    ans2=c*2*max(x,y)
    ans3=a*x+b*y
    print(min(ans1,ans2,ans3))

def __starting_point():
    main()
__starting_point()

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

ans = float("inf")
for c in range(200_001):
    cost = c * C
    cost += A * max(0, X - c // 2)
    cost += B * max(0, Y - c // 2)
    ans = min(ans, cost)
print(ans)


A,B,C,X,Y = map(int,input().split())
min_xy = min(X,Y)
max_xy = max(X,Y)
ans1 = 2*C*min_xy + A*(X-min_xy)+B*(Y-min_xy)
ans2 = A*X+B*Y
ans3 = 2*C*max_xy
print(min(ans1,ans2,ans3))

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

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


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

min_p = 100000000000000
for c in range(0, max(X, Y)*2+1):
    a = X - int(c / 2)
    b = Y - int(c / 2)

    if a < 0 :
        a = 0
    if b < 0:
        b = 0

    p = A*a+B*b+C*c
    min_p = min(min_p, p)
print(min_p)


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

answer = 7000000000
for i in range(100001):
  amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b
  if answer > amount:
    answer = amount
print(answer)

a, b, c, x, y = list(map(int, input().split()))
mmin = -1


def maxint(x, y: int) -> int:
    if x > y:
        return x
    else:
        return y


max = maxint(x, y)
for i in range(0, max+1):
    tmp = 2*c*i + a*(maxint(0, x-i))+b*(maxint(0, y-i))
    if mmin == -1:
        mmin = tmp
        continue
    if tmp < mmin:
        mmin = tmp
print(mmin)


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

import math
saishou = math.inf

temp = 0

for i in range (0, X+1):
	temp = A*i+C*2*(X-i)
	if X-i < Y:
		if 2*C <= B:
			temp+=2*C*(Y-(X-i))
		else:
			temp+=B*(Y-(X-i))
	if saishou > temp:
		saishou = temp
                      
print(saishou)

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

c *= 2
t = 0

if a+b > c:
  v = min([x,y])
  t = v * c
  x, y = x-v, y-v

  if x>0:
    if a<c:
      t = t + a*x
    else:
      t = t + c*x
  elif y>0:
    if b<c:
      t = t + b*y
    else:
      t = t + c*y
else:
  t = a*x + b*y

print(t)


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

print(cost)

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

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

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

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


import sys
def readint():
    return int(sys.stdin.readline())

def readints():
    return tuple(map(int,sys.stdin.readline().split()))

def readintslist(n):
    return [tuple(map(int,sys.stdin.readline().split())) for _ in range(n)]

def main():
    a,b,c,x,y = readints()

    a_pizza = [a*i for i in range(x+1)]
    b_pizza = [b*i for i in range(y+1)]
    ab_pizza = [2*c*i for i in range(max(x,y)+1)]

    ans = []
    for i in range(max(x,y)+1):
        ans.append(a_pizza[max(x-i,0)]+b_pizza[max(y-i,0)]+ab_pizza[i])
    print(min(ans))
def __starting_point():
    main()
__starting_point()

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

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

import math
a, b, c, x, y = map(int, input().split(' '))
ans = float('inf')
c = c*2
for i in range(max(x, y)+1):
    if i > x:
        price = b*(y-i) + c*i
    elif i > y:
        price = a*(x-i) + c*i
    else:
        price = a*(x-i) + b*(y-i) + c*i

    if ans > price:
        ans = price
print(ans)

a,b,c,x,y=map(int,input().split())
p = a*x + b*y
q = 2*c*max(x,y)
r = 2*c*x + b*(y-x)
s = 2*c*y + a*(x-y)
if x >=y:
        print(min(p,q,s))
else:
        print(min(p,q,r))

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

A,B,C,X,Y=map(int,input().split())
if 2*C <= A+B:
  price= 2*C
else:
  price = A+B
maxN = max(X,Y)
miniN = min(X,Y)
res = miniN * price
residue = maxN - miniN
if residue == 0:
  print(res)
elif X > Y:
  res+= min(residue*A, residue*2*C)
  print(res)
elif Y > X:
  res +=  min(residue*B, residue*2*C)
  print(res)

A,B,C,X,Y = map(int,input().split())
ans = 10**10
for k in range(max(X,Y)+1):
    i = max((X-k),0)
    j = max((Y-k),0)
    price = A*i + B*j + C*2*k
    ans = min(ans,price)

print(ans)

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


# coding: utf-8


def main():
    A, B, C, X, Y = list(map(int, input().split()))
    ans = 0
    min_p = min(X, Y)
    d = X - Y

    if A + B > 2 * C:
        ans += 2 * C * min_p
    else:
        ans += (A + B) * min_p

    if d > 0:
        if A > 2 * C:
            ans += 2 * C * d
        else:
            ans += A * d
    elif d < 0:
        if B > 2 * C:
            ans += 2 * C * -d
        else:
            ans += B * -d

    print(ans)

def __starting_point():
    main()

__starting_point()

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

p_A=A*X
p_B=B*Y
total=p_A+p_B

if X>Y:
	a=X-Y
	ab=Y*C*2
	total_ab=C*X*2
	total_1=ab+a*A
	print(min(total_1,total,total_ab))

elif X<Y:
	b=Y-X
	ab=X*C*2
	total_ab=C*Y*2
	total_2=ab+b*B
	print(min(total_2,total,total_ab))

elif X==Y:
	ab=C*X*2
	print(min(ab,total))