CodeEff/ECCO huggingface dataset:
# Original solution
A,B,C,X,Y=list(map(int,input().split()))
if A>=2*C:
  if B>=2*C:
    print((2*C*max(X,Y)))
    exit()
  else:
    print((2*C*X+B*max(0,(Y-X))))
    exit()
elif B>=2*C:
  print((2*C*Y+A*max(0,(X-Y))))
  exit()
else:
  ans=A*X+B*Y
  for i in range(1,min(X,Y)+1):
    p=A*(X-i)+B*(Y-i)+2*C*i
    ans=min(ans,p)
  print(ans)

# Optimized solution
A,B,C,X,Y=list(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))))
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

print((min(A*X+B*Y, min(X, Y)*C*2 + (X-min(X, Y))*A+(Y-min(X, Y))*B, max(X, Y)*C*2)))

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

cost_1 = A*X + B*Y
cost_2 = C * max(X, Y) * 2

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


print((min(cost_1, cost_2, cost_3)))
# Original solution
A,B,C,X,Y = list(map(int, input().split()))

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

print(ans)

# Optimized solution
A, B, C, X, Y = list(map(int,input().split()))
ans = A*X + B*Y

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

print(ans)
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020

@author: liang
"""

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

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 31 11:16:07 2020

@author: liang
"""
###煩雑 => 列挙して最小値を出力
"""
A, B, C, X, Y = map(int,input().split())
if A + B > 2*C:
    if X > Y :
        if A < 2 * C:
            ans = Y * C * 2 + abs(X-Y) * A
        else:
            ans = X * C * 2  ##
    else:
        if B < 2 * C:
            ans = X * C * 2 + abs(X-Y) * B
        else:
            ans = Y * C * 2 ##
else:
    ans = X * A + Y * B 
print(ans)
"""
A, B, C, X, Y = list(map(int,input().split()))
if A + B > 2*C:
    ans1 = max(X,Y) * C * 2  #条件分岐が減る
    if X > Y :
            ans2 = Y * C * 2 + abs(X-Y) * A           
    else:
            ans2 = X * C * 2 + abs(X-Y) * B  
    print((min(ans1,ans2))) #print()が分岐する
else:   
    ans1 = X * A + Y * B 
    print(ans1)
# Original solution
a,b,c,x,y=list(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))))

# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
print((min(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)),a*x+b*y)))
# Original solution
a,b,c,x,y=list(map(int,input().split()))
print((min(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)),a*x+b*y)))

# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
d= a*x+b*y
e= 2*c*x+b*max(0,y-x) #yが多い
f= 2*c*y+a*max(0,x-y) #xが多い
print((min(d,e,f)))
# Original solution
a,b,c,x,y = list(map(int,input().split()))
ab = min(a+b, c*2)
if x>y:
    tmp, tmp2, tmp3 = y, (x-y)*a, (x-y)*ab
else:
    tmp, tmp2, tmp3 = x, (y-x)*b, (y-x)*ab
ans = 0
for i in range(tmp):
    ans += ab
print((ans+min(tmp2, tmp3)))


# Optimized solution
a, b, c, x, y = list(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))
# Original solution
A,B,C,X,Y = list(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)

# Optimized solution
A,B,C,X,Y = list(map(int,input().split()))
if 2*C<=A+B:
    if X<=Y:
        ans = 2*C*X
        ans += (Y-X)*min(B,2*C)
    else:
        ans = 2*C*Y
        ans += (X-Y)*min(A,2*C)
else:
    if X<=Y:
        ans = (A+B)*X
        ans += (Y-X)*B
    else:
        ans = (A+B)*Y
        ans += (X-Y)*A
print(ans)
# Original solution
A,B,C,X,Y = list(map(int,input().split()))
if 2*C<=A+B:
    if X<=Y:
        ans = 2*C*X
        ans += (Y-X)*min(B,2*C)
    else:
        ans = 2*C*Y
        ans += (X-Y)*min(A,2*C)
else:
    if X<=Y:
        ans = (A+B)*X
        ans += (Y-X)*B
    else:
        ans = (A+B)*Y
        ans += (X-Y)*A
print(ans)    

# Optimized solution
A,B,C,X,Y = list(map(int,input().split()))
if X<=Y:
    ans = X*min(A+B,2*C)
    ans += (Y-X)*min(B,2*C)
else:
    ans = Y*min(A+B,2*C)
    ans += (X-Y)*min(A,2*C)
print(ans)
# Original solution
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

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

if __name__ == '__main__':
    resolve()


# Optimized solution
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

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

if __name__ == '__main__':
    resolve()
# Original solution
A,B,C,X,Y = list(map(int, input().split()))
ans = A*X+B*Y
for i in range(max(X,Y)+1):
  ans = min(ans, A*max(X-i,0)+B*max(Y-i,0)+C*i*2)
print(ans)


# Optimized solution
A,B,C,X,Y = list(map(int, input().split()))
if A+B < 2*C:
  ans = A*X+B*Y
else:
  XY = min(X,Y)
  ans = min(A*(X-XY) + B*(Y-XY) + 2*C*XY, 2*C*max(X,Y))
print(ans)
# Original solution

A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=10E+10  

for i in range(0,max_pizza*2+2,2):#ABピザをi枚買う(iは偶数)
    
    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print((int(ans)))



# Optimized solution

A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=10E+10  

for i in range(0,max_pizza*2+2,2):#ABピザをi枚買う(iは偶数)
    #max_pizza*2+2の「+2」に注意。例えばrange(0,10,2)
    #のとき0,2,4,6,8までしか出てこない。(0,10+2,2)なら10まで出る

    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print((int(ans)))
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

AB = A + B

num_A = 0
num_B = 0
num_C = 0
ans_cost = 5000 * 2 * 10**5
if 2 * C > AB:
    num_A = X
    num_B = Y
    num_C = 0
    ans_cost = int(A*num_A + B*num_B + C*num_C)
else:
    min_C = min(X,Y) *2
    max_C = max(X,Y) *2
    for i in range(min_C, max_C+1, 2):
        num_A = X - i / 2
        num_B = Y - i / 2
        if num_A < 1:
            num_A = 0
        if num_B < 1:
            num_B = 0
        
        total_cost = int(A*num_A + B*num_B + C*i)
    
        if total_cost < ans_cost:
            ans_cost = total_cost

print(ans_cost)

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


min_cost = 0

if X - Y > 0:
    temp_cost = 2 * C * Y
    temp_cost += A * (X - Y)    

    temp_cost2 = 2 * C * X

    if temp_cost > temp_cost2:
        min_cost = temp_cost2
    else:
        min_cost = temp_cost

else:
    temp_cost = 2 * C * X
    temp_cost += B * (Y - X)

    temp_cost2 = 2 * C * Y

    if temp_cost > temp_cost2:
        min_cost = temp_cost2
    else:
        min_cost = temp_cost


temp_cost3 = A * X + B *Y

if temp_cost3 < min_cost:
    min_cost = temp_cost3

print(min_cost)
# Original solution
if __name__ == "__main__":
    A, B, C, X, Y = list(map(int, input().split()))
    ans = 0
    if (A + B) >= 2*C:
        # ABピザ2枚買ってAとBに分けた方がお得
        if (A >= B):
            if (B >= 2*C):
                # 全部ABの方がお得
                if X >= Y:
                    ans += (2*C) * X
                    print(ans)
                    exit()
                else:
                    ans += (2*C) * Y
                    print(ans)
                    exit()
            elif (A >= 2*C):
                # Aの分はABピザで買ったほうがお得
                ans += (2*C) * X
                if Y >= X:
                    ans += A * (Y - X)
                print(ans)
                exit()
            else:
                # 枚数が少ない方をABで買う
                if X >= Y:
                    ans += (2*C) * Y
                    ans += A * (X - Y)
                else:
                    ans += (2*C) * X
                    ans += B * (Y - X)
                print(ans)
                exit()
        else:
            if (A >= 2*C):
                if X >= Y:
                    # 全部ABの方がお得
                    ans += (2*C) * X
                    print(ans)
                    exit()
                else:
                    # 全部ABの方がお得
                    ans += (2*C) * Y
                    print(ans)
                    exit()
            elif (B >= 2*C):
                # Bの分はABピザで買ったほうがお得
                ans += (2*C) * Y
                if X >= Y:
                    ans += A * (X - Y)
                print(ans)
                exit()
            else:
                # 枚数が少ない方をABで買う
                if X >= Y:
                    ans += (2*C) * Y
                    ans += A * (X - Y)
                else:
                    ans += (2*C) * X
                    ans += B * (Y - X)
                print(ans)
                exit()
    else:
        # 普通に買ったほうがよい
        ans += A * X + B * Y
        print(ans)
        exit()


# Optimized solution
# -*- coding:utf-8 -*-
# https://atcoder.jp/contests/abc095/tasks/arc096_a

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

    ans = 0
    # 用意するピザの少ない方をまず買う
    if A+B <= C*2:
        # 1枚ずつ買ったほうが安い場合
        if X <= Y:
            ans += A*X + B*X
        else:
            ans += A*Y + B*Y
    else:
        # Cを2枚買った方が安い場合
        ans += min(X, Y)*C*2

    # 残りのピザを買う
    if X >= Y:
        if A <= C*2:
            ans += (X-Y)*A
        else:
            ans += (X-Y)*C*2
    else:
        if B <= C*2:
            ans += (Y-X)*B
        else:
            ans += (Y-X)*C*2

    print(ans)


if __name__ == "__main__":
    solve()
# Original solution
A,B,C,X,Y=list(map(int,input().split()))

K=10**9
for i in range(10**5+1):
    S=i*2*C+max(0,X-i)*A+max(0,Y-i)*B
    K=min(K,S)
print(K)

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

a=min(X,Y)*min(A+B,2*C)

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


print(a)
# Original solution
A,B,C,X,Y = list(map(int,input().split()))
p_sum = []
for i in range(100001):
  p_sum.append(i*2*C + max(0,X-i)*A + max(0,Y-i)*B)
print((min(p_sum)))

# Optimized solution
A,B,AB,X,Y = list(map(int,input().split()))
p_sum = []
for i in range(10**5+1):
  p_sum.append(i*2*AB + max(0,X-i)*A + max(0,Y-i)*B)
print((min(p_sum)))
# Original solution
a,b,c,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))

# Optimized solution
a,b,c,x,y=list(map(int,input().split()));print((min(x*a+y*b,2*x*c+b*max(0,y-x),2*y*c+a*max(0,x-y))))
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

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

print(ans)

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

if X > Y:
    v = A
else:
    v = B

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

print(ans)
# Original solution
def resolve():
  a, b, c, x, y = list(map(int, input().split()))
  ans = a * x + b * y
  ans = min(ans, c * max(x, y) * 2)
  if x > y:
    ans = min(ans, 2 * c * y + a * (x - y))
  else:
    ans = min(ans, 2 * c * x + b * (y - x))

  print(ans)
  return

if __name__ == "__main__":
  resolve()


# Optimized solution
def resolve():
  a, b, c, x, y = list(map(int, input().split()))
  ans = a * x + b * y
  # A を AB で代替する
  ans = min(ans, c * x * 2 + max(0, b * (y - x)))
  # B を AB で代替する
  ans = min(ans, c * y * 2 + max(0, a * (x - y)))

  print(ans)
  return

if __name__ == "__main__":
  resolve()
# Original solution
a, b, c, x, y = list(map(int, input().split()))

ans = float("inf")
for k in range(0, max(x, y)*2+1, 2):
    i = 0 if x-k//2 < 0 else x-k//2
    j = 0 if y-k//2 < 0 else y-k//2
    ans = min(ans, a*i+b*j+c*k)

print(ans)


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

ans = float("inf")
for i in range(0, max(2*x, 2*y)+1, 2):
    na = 0 if x-i//2 < 0 else x-i//2
    nb = 0 if y-i//2 < 0 else y-i//2
    ans = min(ans, c*i + a*na + b*nb)

print(ans)
# Original solution
A,B,C,X,Y = list(map(int,input().split()))

ans = 10**12
for c in range(max(X,Y) + 1):
    cost = C*2*c
    a = max(0, X-c)
    b = max(0, Y-c)
    cost += A*a + B*b
    ans = min(cost, ans)
print(ans)

# Optimized solution
A,B,C,X,Y = list(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)
# Original solution
A,B,C,X,Y = list(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)

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

ans = float('inf')

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)

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

# ans = float('inf')

# 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)

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)))
# Original solution
a, b, c, x, y = list(map(int, input().split()))

z = max(x,y) * 2
min_sum = c * z

for i in range(z):
    r = max(0, y - i) * b
    t = max(0, x - i) * a
    sum = c * i * 2 + r + t
    if sum < min_sum:
        min_sum = sum

print(min_sum)

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

plan_a = c * (2*x) + max(0, y-x) * b
plan_b = c * (2*y) + max(0, x-y) * a
plan_c = a * x + b * y

print((min(plan_a, plan_b, plan_c)))
# Original solution
#python3
INF = int(1e9)
def main():
    a, b, c, x, y = list(map(int, input().split()))
    ans = INF
    for i in range(2*10**5+100):
        t = 2*c*i + max(x-i, 0) * a + max(y-i, 0) * b
        ans = min(ans, t)
    print(ans)
main()

# Optimized solution
INF = int(1e5)+5

def main():
    a, b, c, x, y = list(map(int, input().split()))
    ans = INF*INF
    for i in range(INF):
        tmp = 2*i*c + a*max(x-i, 0) + b*max(y-i, 0) 
        ans = min(tmp, ans)
    print(ans)
main()
# Original solution
a, b, c, x, y = list(map(int, input().split()))
ans = 10 ** 15
for i in range(max(x, y) * 2 + 1):
  n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b
  ans = min(ans, n)
print(ans)  

# Optimized solution
a, b, c, x, y = list(map(int, input().split()))
ans = 10 ** 15
for i in range(max(x, y) * 2 + 1):
  if x - i//2 < 0 and y - i//2 < 0:
    n = c * i 
  elif x - i//2 < 0:
    n = c * i + (y - i//2) * b
  elif y - i//2 < 0:
    n = c * i + (x - i//2) * a
  else:
    n = c * i + (x - i//2) * a + (y - i//2) * b
  ans = min(ans, n)
print(ans)
# Original solution
A, B, C, X, Y = list(map(int, input().split()))
ans = min(A * X + B * Y, 2 * C * X + B * abs(X - Y), 2 * C * Y + A * abs(X - Y), 2 * C * max(X, Y))
print(ans)


# Optimized solution
A, B, C, X, Y = list(map(int, input().split()))
ans = min(A * X + B * Y, 2 * C * max(X, Y), 2 * C * X + B * (Y - X) if X < Y else 2 * C * Y + A * (X - Y))
print(ans)
# Original solution
def main():
    A, B, C, X, Y = list(map(int, input().split()))
    print((
        min(A * X + B * Y,
            2 * C * max(X, Y),
            2 * C * min(X, Y) + (B if X < Y else A) * abs(X - Y))))
    return


main()


# Optimized solution
def main():
    A, B, C, X, Y = list(map(int, input().split()))
    if 2 * C < A + B:
        print((min(
            2 * C * max(X, Y),
            2 * C * min(X, Y) + A * (X - min(X, Y)) + B * (Y - min(X, Y))
        )))
    else:
        print((A * X + B * Y))
    return


main()
# Original solution
a, b, c, x, y = list(map(int, input().split()))
ans = float('inf')

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

print(ans)

# Optimized solution
a, b, c, x, y = list(map(int, input().split()))
ans = float('inf')

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

print(ans)
# Original solution
a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
m = max(x, y)
for i in range(1, m+1):
  x -= 1
  y -= 1
  if x < 0:
    x = 0
  if y < 0:
    y = 0
  temp = c*(i*2) + x*a + y*b
  if temp < ans:
    ans = temp

print(ans)


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

print(ans)
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

# ABピザ以外で考えると
ans = A * X + B * Y

# ABピザを全探索して考える
for i in range(2, max(2*X,2*Y)+1, 2):
    x = X - i // 2
    y = Y - i // 2
    ans = min(ans, A * max(0,x) + B * max(0,y) + C * i)

print(ans)


# Optimized solution
A, B, C, X, Y = list(map(int, input().split()))
ans = 1 << 30
# ABピザを全探索して考える
for i in range(0, max(2*X,2*Y)+1, 2):
    x = X - i // 2
    y = Y - i // 2
    ans = min(ans, A * max(0,x) + B * max(0,y) + C * i)

print(ans)
# Original solution
import math

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

# cを全探索？
res = float('inf')
for i in range(max(x,y)*2+1):
    money = i * c
    if i/2<x:
        money += math.ceil(x-i/2) * a
    if i/2<y:
        money += math.ceil(y-i/2) * b
    res = min(res,money)

print(res)


# Optimized solution
res = 10**30
a,b,c,x,y = list(map(int,input().split()))
for i in range(0,max(x,y)+1):
    # ABを2*iまい買う
    tmp = 2 * i * c
    xx,yy = x - i, y - i
    tmp += max(0,xx) * a
    tmp += max(0,yy) * b
    res = min(res, tmp)
print(res)
# Original solution
A, B, C, X, Y = [int(_) for _ in input().split()]
ans = A * X + B * Y
for i in range(max(X, Y) + 1):
    cost = 2 * C * i
    if X > i:
        cost += A * (X - i)
    if Y > i:
        cost += B * (Y - i)
    ans = min(ans, cost)
print(ans)

# Optimized solution
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 - Y) + B * (M - X), A * X + B * Y)))
# Original solution
A,B,C,X,Y = list(map(int, input().split()))
ans = 5000 * 10**5 * 4 + 1
for c in range(0,max(X,Y)*2+1,2):
    a = c * C
    x,y = max(0,X-c//2), max(0,Y-c//2)
    a += A*x + B*y
    ans = min(ans, a)

print(ans)

# Optimized solution
a,b,c,x,y=list(map(int, input().split()))
c*=2
ans=10**9
for cc in range(max(x,y)+1):
    tmp = cc * c
    tmp += max(0, x-cc)*a
    tmp += max(0, y-cc)*b
    ans = min(ans, tmp)
print(ans)
# Original solution
a,b,c,x,y = list(map(int,input().split()))
xy = max(x,y)*2+1
print((min([c*i + max(0,a*(x-i//2)) +max(0,b*(y-i//2)) for i in range(0,xy,2)])))

# Optimized solution
a,b,c,x,y = list(map(int,input().split()))
if x < y:
    a, b, x, y = b, a, y, x
print((min(a*x+b*y,2*c*y + a*(x-y),2*c*x)))
# Original solution
a, b, c, x, y = list(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)

# Optimized solution
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):
    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)
# Original solution
A, B, C, X, Y = list(map(int, input().split()))

max_iter = max(X, Y) * 2
ans = float("inf")
for i in range(max_iter):
    a = max(X - i, 0)
    b = max(Y - i, 0)
    price = 2*C * i + A * a + B * b
    ans = min(ans, price)

print(ans)

# Optimized solution
A, B, C, X, Y = list(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)
# Original solution
#abc095c

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


# Optimized solution
#abc095c

a,b,c,x,y=list(map(int,input().split()))
res=float('inf')
for i in range(max(x,y)+2):
 t=2*c*i+max(0,x-i)*a+max(0,y-i)*b
 res=min(res,t)
print(res)
# Original solution
# ABC95_C
a,b,c,x,y = list(map(int,input().split()))

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

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

if A + B < 2*C:
    print((A*X + B*Y))
else:
    Z =min(X,Y)
    print((min(2*C*max(X,Y), 2*C*Z+A*(X-Z)+B*(Y-Z))))
# Original solution
a,b,c,x,y = list(map(int,input().split()))
l = min(x,y)
m = max(x,y)
M = a * x + b * y
for i in range(1,l+1):
  K = a * (x-i) + b * (y-i) + 2 * c * i #これだとマイナスになってしまう
  M = min(M,K)
for i in range(l+1,m+1):
  if x == l:
    K = b * (y-i) + 2 * c * i
  else:
    K = a * (x-i) + 2 * c * i
  M = min(M,K)
print(M)


# Optimized solution
a,b,c,x,y = list(map(int,input().split()))
l = min(x,y)
m = max(x,y)
M = a * x + b * y
for i in range(1,l+1):
  K = a * (x-i) + b * (y-i) + 2 * c * i 
  M = min(M,K)
for i in range(l+1,m+1):
  if x == l:
    K = b * (y-i) + 2 * c * i
  else:
    K = a * (x-i) + 2 * c * i
  M = min(M,K)
print(M)
# Original solution
a,b,c,x,y=list(map(int, input().split()))
answer=[]
for i in range(max(x,y)*2+1):
    answer.append((x-i//2)*a+(y-i//2)*b+i*c)
    if x-i//2<0:
        answer[i]=answer[i]-(x-i//2)*a
    if y-i//2<0:
        answer[i]=answer[i]-(y-i//2)*b
print((min(answer)))

# Optimized solution
a,b,c,x,y=list(map(int,input().split()));print((min(c*2*min(x,y)+abs(x-y)*min((a if x>y else b),2*c),a*x+b*y)))
# Original solution
a,b,c,x,y=list(map(int,input().split()))
l=sorted([a,b,c*2])
if l[0]==c*2:
    print((max(x,y)*c*2))
elif l[1]==c*2:
    if l[0]==a:
        print((y*c*2+max((x-y),0)*a))
    else:
        print((x*c*2+max((y-x),0)*b))
else:
    if a+b>=c*2:
        if x>=y:
            print((y*2*c+(x-y)*a))
        else:
            print((x*2*c+(y-x)*b))
    else:
        print((x*a+y*b))

# Optimized solution
a,b,c,x,y=list(map(int,input().split()))
if x>=y:
    if c*2<=min(a,b):
        print((c*2*x))
    elif c*2<=max(a,b):
        if a>=b:
            print((c*2*x))
        else:
            print((c*2*y+a*(x-y)))
    elif c*2<=a+b:
        print((c*2*y+a*(x-y)))
    else:
        print((a*x+b*y))
else:
    if c*2<=min(a,b):
        print((c*2*y))
    elif c*2<=max(a,b):
        if a<=b:
            print((c*2*y))
        else:
            print((c*2*y+b*(y-x)))
    elif c*2<=a+b:
        print((c*2*x+b*(y-x)))
    else:
        print((a*x+b*y))