peterverebics/CodeNet_Python_118 huggingface dataset:
a,b,c,x,y=map(int,input().split())
sum=0
if a+b>=2*c:
  sum+=2*c*min(x,y)
  x-=min(x,y)
  y-=min(x,y)
  if x==0:
    if b>=2*c:
      sum+=2*c*y
    else:
      sum+=b*y
  elif y==0:
    if a>=2*c:
      sum+=2*c*x
    else:
      sum+=a*x
else:
  sum+=a*x+b*y
print(sum)
A,B,C,X,Y=map(int,input().split())
ans=5000*(10**5)+1

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

if a//2 + b//2 > c:
    buf = min(x,y) * c * 2
    buf2 = max(x,y) * c * 2
    if min(x,y) == y:
        tmp = buf + abs(x-y) * a
    else:
        tmp = buf + abs(x-y) * b
    ans = min(buf2,tmp)
else:
    ans = x * a + y * b

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

K = 2 * C - A - B
S = A*X + B*Y
t =-1 * S * K
z = min(X, Y, t)
Z = max(X, Y)

if K >= 0:
  print(S)
elif S > Z*C*2:
  print(Z*C*2)
else:
  P =S + K* z
  print(P)
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max):
    s = a*(x-i)+b*(y-i)+c*i*2
    l.append(s)
  return min(l)   

A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
A, B, C, X, Y = map(int, input().split())
faceAB = (A + B) / 2
if faceAB <= C:
    print(X * A + Y * B)
elif 2 * C <= A and 2 * C <= B:
    print(2 * C * max(X, Y))
else:
    if X <= Y:
        print(2 * C * min(X, Y) + ((Y - X) * B))
    else:
        print(2 * C * min(X, Y) + ((X - Y) * A))
A,B,C,X,Y=map(int,input().split(' '))

price=0
if X>Y:    
  N_same=Y
  flag='A'
else:
  N_same=X
  flag='B'
  
if A+B >2*C:
  price+=2*C*N_same
else:
  price+=(A+B)*N_same

if flag=='A':
  if A*(X-Y)>2*C*(X-Y):
    price+=2*C*(X-Y)
  else:
    price+=A*(X-Y)
else:
  if B*(X-Y)>2*C*(X-Y):
    price+=2*C*(X-Y)
  else:
    price+=B*(X-Y)

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

ans = 0

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

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

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

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

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

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

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

P=X*A+B*Y
if X>=Y:
    Q=C*2*Y+(X-Y)*A
    QQ=X*A+C*2*Y
    L=X*2*C
elif Y>X:
    Q=C*2*Y+(Y-X)*B
    QQ=Y*B+X*2*C
    L=Y*2*C



print(min(P,Q,L,QQ))
A,B,C,X,Y = map(int,input().split())
mini=float("inf")

for a in range(0,X+1):
  c_num = 2*(X-a)
  b_num = Y- (X-a)
  if b_num>=0:
    P= A*a + B*b_num + C*c_num
    #print(a,b_num,c_num,P)
    mini=min(mini,P)

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

n = min(X,Y)

sum = 0

sum = min(n*2*C, A*n+B*n)

if X>Y:
    n = X-n
    sum = sum + n*A
else:
    n = Y - n
    sum = sum + n*B

sum_ab = X*A + Y*B

sum_a_b = 2*(X+Y)*C


print(min(sum,sum_ab,sum_a_b))
A, B, C, X, Y = map(int, input().split())
ans = 1e1000
for i in range(0, 2*min(X, Y)+1, 2):
  ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))
print(ans)
a,b,c,x,y = map(int,input().split())
z = 0
p = 0

if a + b < c * 2:
    p = a * x + b * y
else:
    if x > y:
        x -= y
        z = y * 2
        y = 0
        if a > c * 2:
            z += x * 2
            x = 0

    else:
        y -= x
        z = x * 2
        x = 0
        if b > c * 2:
            z += 0

print(x * a + y * b + z * c)
A,B,C,X,Y = list(map(int, input().split()))

ans1 = 0
ans2 = 0
ans3 = 0

# 通常のケース
ans1 = A * X + B * Y

# 半分のケース
if X >= Y:
    ans2 = Y * 2 * C + (X - Y) * A
    if Y * 2 > X:
        ans3 = X * 2 * C
else:
    ans2 = X * 2 * C + (Y - X) * A
    if X * 2 > Y:
        ans3 = Y * 2 * C

print(min(ans1,ans2,ans3))
pa, pb, pab, x, y = map(int, input().split())
li = []
if x-y>= 0:
    li.append(pa*x+pb*y)
    li.append(pa*(x-y)+pab*2*y)
    li.append(pa*(x-y+1)+pb+pab*2*(y-1))
    li.append(pab*2*x)
else:
    li.append(pa*x+pb*y)
    li.append(pb*(y-x)+pab*2*y)
    li.append(pa+pb*(y-x+1)+pab*2*(y-1))
    li.append(pab*2*y)
li.sort()
print(li[0])
a,b,c,x,y  = map(int,input().split())
if a+b > c*2:
    mmm = min(x,y)
    aaa = max(x,y)
    if x >= y:
        print(c*2*mmm + a*(aaa-mmm))
    elif x < y:
        print(c*2*mmm + b*(aaa-mmm))
else:
    print(a*x + b*y)
[a,b,c,x,y] = [int(i) for i in input().split()]

ans = a * x + b * y
cnt = 1

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

m = 100000000
for i in range(max(x, y)*2):
    total = a*(max(0, x-i//2)) + b*(max(0, y-i//2)) + c*i
    if total < m:
        m = total

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

l = a * x + b * y
m = c * max(x, y) * 2

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

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

m = 1000000000000
for i in range(max(x, y)*2):
    total = a*(max(0, x-i//2)) + b*(max(0, y-i//2)) + c*i
    if total < m:
        m = total

print(m)
a, b, c, x, y = map(int, input().split())
ans = 0
if c < a and c < b:
  ans += c * max(x, y)*2
  print(ans)
  exit()
if (c-a+c-b) > 0:
  ans += a*x + b*y
else:
  s = min(x, y)
  ans += min(c*s*2 + min(a, b)*(max(x, y) - s), c*max(x, y)*2)
print(ans)
a, b, c, x, y = map(int, input().split())
l = []

for i in range(x+y):
    if i%2!=0:
        continue
    if (i//2)>=x:
        a_p = 0
        b_p = b*(y-(i//2))
    if (i//2)>=y:
        a_p = a*(x-(i//2))
        b_p = 0
    else:
        a_p = a*(x-(i//2))
        b_p = b*(y-(i//2))
        
    price = (c*i)+ a_p + b_p
    l.append(price)

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

ans = float('inf')
for i in range(0, 2 * max(x, y)+1, 2):
    if min((x - (i // 2)), (y - (i // 2))) < 0:
        break
    #合計費用
    total = a * (x - (i // 2)) + b *(y - (i // 2)) + c * i
    ans = min(ans, total)
print(ans)
A, B, C, X, Y = map(int, input().split())

ans = float('inf')

if A + B >= 2 * C:
    p = (2 * max(X, Y)) * C
    ans = min(ans, p)
else:
    for x in range(X + 1):
        for y in range(Y + 1):
            c = max(X - x, Y - y)
            p = x * A + y * B + (2 * c) * C
            ans = min(ans, p)

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

if boundary_value <= (min_value + max_value):
    if boundary_value <= min_value:
        print(boundary_value * max(x, y))
    elif (a == max_value and y <= x) or (b == max_value and x <= y):
        print(boundary_value * max(x, y))
    else:
        print(boundary_value * (max(x, y) - abs(x - y)) +
              min_value * abs(x - y))
elif (min_value + max_value) < boundary_value:
    print(a * x + b * y)
a, b, c, x, y = map(int, input().split())

ans = 10**5
for i in range(10**5):
    tmp = 2*c*i + max((x-i), 0)*a + max((y-i), 0)*b
    if x < i and y < i:
            break
    ans = min(ans, tmp)
print(ans)
if __name__ == '__main__':
    A, B, C, X, Y = map(int, input().split())
    min_cost = C*2*max(X, Y) 
    for c in range(-1, 2*pow(10, 5)+2, 2):
        a = X-c//2
        b = Y-c//2
        if a==100000 and b==100000:
            print("ans")
        if a>=0 and b>=0:
            cost = A*a+b*B+C*c
            min_cost = min(cost, min_cost)
    print(min_cost)
a, b, c, x, y = map(int, input().split())

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

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

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

m = 10^10
for i in range(X):
  for j in range(Y):
    k = max(2*X-2*i,2*Y-2*j)
    m = min(m,A*i+B*j+C*k)
    
print(m)
a, b, c, x, y = map(int, input().split())

if a > 2*c and b > 2*c:
    ans = 2*c*max(x, y)
elif a < c and  b < c:
    ans = a*x + b*y
else:
    ans = float('inf')
    for i in range(min(x, y)+1):
        p = 2*c*i + (x-i)*a + (y-i)*b #; print(i, p)
        ans = min(p, ans)
print(ans)
#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
if x<=y:
  price3 = x*2*c
  price3 += (y-x)*b
else:
  price3 = y*2*c
  price3 += (y-x)*a

print(min(price1, price2, price3))
a, b, c, x, y =map(int, input().split())
ab = 2*c
i = 1
cost = 0
while True:
    cost = i *ab
    if i <= x  or i <= y:
        break
    i += 1
cost += a *(max(0, (x-i)))
cost += b *(max(0, (y-i)))
print(cost)
A, B, C, X, Y = map(int, input().split())

if A*X + B*Y > 2*C*max(X, Y):
    print(2*C*max(X, Y))

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

cost = 0
for i in range(min(x, y)):
    if a + b > 2 * c:
        cost += 2 * c
    else:
        cost += a + b

for i in range(abs(x - y)):
    if a < 2 * c:
        cost += a
    elif b < 2 * c:
        cost += b
    else:
        cost += 2 * c

print(cost)
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 8
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)
a, b, c, x, y = map(int, input().split())
if (a >= 2 * c and b >= 2 * c): print(int(max(x, y) * 2 * c))
elif (a + b <= 2 * c): print(int(a * x + b * y))
else: print(int(min(x, y) * 2 * c) + int((max(x, y) - min(x, y)) * min(a, b)))
a, b, c, x, y = map(int, input().split())

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

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


print(min(a, b))
a,b,c,x,y = map(int,input().split())
p = 0

if x > y:
    p += (x - y) * a
    x = y
if x < y:
    p += (y - x) * b
    y = x
if x > 0:
    n = x * 2 * c
    m = x * a + y * b
    p += min(n,m)

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

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

print(ans)
a, b, c, x, y = map(int, input().split())
half = min(x, y) * 2 * c + (max(x, y) - min(x, y)) * min(a, b)
a_b = a * x + b * y
halfOnly = max(x, y) * 2 * c
print(min(min(half, a_b), halfOnly))
A, B, C, X, Y = map(int, input().split())
ans = 0
for i in range(X):
  for j in range(Y):
    for k in range(X+Y, 2):
      if i+k/2==X and j+k/2==Y:
        ans = min(ans, A*i+B*j+C*k)
print(ans)
A,B,C,X,Y = map(int, input().split())
ans = 0
if A >= C:
    ans += 2*C*X
    Y -= X
    if Y > 0:
        if B >= C:
            ans += 2*C*Y
        else:
            ans += B*Y
else:
    if B >= C:
        ans += 2*C*Y
        X -= Y
    else:
        ans += B*Y
    if X > 0:
        ans += A*X
print(ans)
a, b, c, x, y = map(int, input().split())

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

first = 2 * max(x,y) + 1
total = 5000 * 10 ** 5 * 2

for i in range(0,x+1):
    for j in range(0,y+1):
        k = 2 * max(x-i,y-j)
        if first > k :
            first = k
            target = a * i + b * j + c * k
            if total > target:
                    total = target
            else:
                continue
        else:
            break
    
print(total)
a,b,c,x,y = map(int,input().split())
A_B = a*x+b*y
A_AB = a*x+2*c*y
AB_B = 2*c*x+b*y
AB = 2*c*max(x,y)
ans = min(A_B,A_AB,AB_B,AB)
print(ans)
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 Y<=X:
      ans+=2*C*(X-Y)
    else:
      ans+=B*(Y-X)
print(ans)
a, b, c, x, y = map(int, input().split())
ans = 0


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

elif a + b < c * 2:
    ans += (a * x) + (b * y)


print(ans)
a, b, c, x, y = map(int, input().split())
ans = x * a + y * b
ans = min(ans, abs(x - y) * a + min(x, y) * c * 2)
ans = min(ans, max(x, y) * c * 2)
print(ans)
a, b, c, x, y = (int(each) for each in input().split())

cost = [x*a + y*b]
for i in range(max(x, y)*2+1):
    numofabpizza = i*2
    numofapizza = max(0, (x-numofabpizza))
    numofbpizza = max(0, (y-numofabpizza))
    # print(numofapizza, numofbpizza, numofabpizza)
    cost.append(numofapizza*a + numofbpizza*b + (2*numofabpizza)*c)
# print(cost)
print(min(cost))
a,b,c,x,y=map(int,input().split())
ans=100000
for i in range(1,100001):
    tmp=i*2*c+max(0,x-i)*a+max(0,y-i)*b
    ans=min(ans,tmp)
print(ans)
a,b,c,x,y = map(int, input().split())
kei = 0
if c > a/2 + b/2:
    kei = a * x + b*y

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

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


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

if a>= c*2 and b >= c*2:
    print(max(x,y)*c*2)

elif a>= c*2 and x >=y :
    print(x*c*2)

elif b >= c*2 and y<=x:
    print(y*c*2)

elif a + b < c*2:
    print(a*x+b*y)
    
elif a+b >= c*2:
    if x > y:
        print(y*c*2+(x-y)*a)
    else:
        print(x*c*2+(y-x)*b)
A, B, C, X, Y = map(int, input().split())
sum = 0
min_num = 10**10
num = [0]*3
if min(A/2, B/2) > C:
    print(C*Y*2)
    exit()
for c in range(min(X, Y)+1):
    sum += C*c*2
    num[0] = c*2
    for a in range(X-c):
        sum += A
        num[1] = a
    for b in range(Y-c):
        sum += B
        num[2] = b
    if min_num > sum:
        min_num = sum
    print(sum, num)
    sum = 0
print(min_num)
a,b,c,x,y = map(int,input().split())
ans = 0

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

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

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

print(ans)
def solve(a,b,c,x,y):
  l = []
  for i in range(5*(10**4)+1):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
a,b,c,x,y = map(int,input().split())
#print(a,b,c,x,y)

if x > y:
  d = x
else:
  d = y

#print(d)

for i in range(x + 1):
    for j in range(y + 1):
        for k in range(2 * d + 1):
            if (i + k / 2 >= x and j + k / 2 >= y):
                price = a * i + b * j + c * k
                maxprice = a * x + b * y
                if price <= maxprice:
                    maxprice = price



#print(p_lists)
print(price)
A, B, C, X, Y = list(map(int, input().split()))

a_total = A * X
b_total = B * Y

total = a_total + b_total

c_mul = (X + Y) // 2

c_total = C * (2 * c_mul)

if X > Y:
    c_total += A * (X - c_mul)
if Y > X:
    c_total += B * (Y - c_mul)

if total > c_total:
    print(c_total)
else:
    print(total)
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

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

k = max(x,y)
minman = a * b * c

k = k // 2
for i in range(k,-1,-1):
    now_x = x
    now_y = y
    ans = c * (i * 4)
    now_x = now_x - (i * 2)
    now_y = now_y - (i * 2)
    if now_x < 0:
        now_x = 0
    if now_y < 0:
        now_y = 0
    ans +=( now_x * a ) + ( now_y * b)
    if minman > ans:
        minman = ans
print(minman)
def solve(a,b,c,x,y):
  k_max = min(x,y)
  l = []
  for i in range(k_max):
    s = a*max((x-i),0)+b*max((y-i),0)+c*i*2
    l.append(s)
  return min(l)   

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

if (a+b) <= c*2:
    print(a*x+b*y)
else:
    if x >= y:
        tmp1 = y*2*c + (x-y)*a
        tmp2 = c*x*2
        print(min(tmp1, tmp2))
    else:
        tmp1 = x * 2 * c + (y-x) * a
        tmp2 = c * y * 2
        print(min(tmp1, tmp2))
a, b, c, x, y = map(int, input().split())
ab = min(x, y)//2 * 2
ans1 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ans2 = x*a + y*b

ab = max(x, y)//2 * 2
ans3 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ab = -(-max(x, y)/2) * 2
ans4 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ab = -(-min(x, y)/2) * 2
ans5 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b
print(min(ans1, ans2, ans3, ans4, ans5))
a, b, c, x, y = map(int, input().split())
ans = 0

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

print(ans)
A, B, C, X, Y = map(int, input().split())
value = float('inf')
D = max(A,B)
for i in range(D+1):
  E = max((X-i)*A, 0)
  F = max((Y-i)*B, 0)
  valueX = 2*i*C+E+F
  if valueX < value:
    value  = valueX
print(str(value))
def main():
  A, B, C, X, Y = map(int, input().split())
  if A + B <= 2*C:
    print(A*X + B*Y)
  elif 2*C < A and 2*C < B:
    print(C*max(X,  Y)*2)
  elif 2*C < A or 2*C < B:
    print(C*max(X,  Y)*2)
  else:
    if X < Y:temp = B
    else:  temp = A
    print(C*min(X, Y)*2 + temp*(abs(X-Y)))
if __name__ == "__main__":
  main()
A,B,C,X,Y = map(int, input().split())

n = min(X,Y)

sum = 0

sum = min(n*2*C, A*n+B*n)

if X>Y:
    n = X-n
    sum = sum + n*A
else:
    n = Y - n
    sum = sum + n*B

print(sum)
def main():
    a, b, c, x, y = map(int, input().split())
    d = [a, b]
    i, j = max(x, y), min(x, y)
    n = i // 2 * 2
    f = i == x
    if 2 * c * n > (a + b) * n:
        ans = a * x + b * y
    else:
        ans = c * 2 * n + (i % 2 == 1) * min(2 * c, d[not f])

    print(ans)


if __name__ == '__main__':
    main()
import itertools
a,b,c,x,y = map(int, input().split(" "))
ans = 10 ** 10

if min(a, b) > 2 * c:
  print(c * max(x, y) * 2)

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

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

ans2 = x*a + y*b

ab = max(x, y)//2 * 2
ans3 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b

ab = max(x, y)//2 * 2
ans4 = ab*2*c + max(0, x-ab)*a + max(0, y-ab)*b
print(min(ans1, ans2, ans3, ans4))
A,B,C,X,Y = map(int,input().split())

plan1 = (A*X) + (B*Y)
plan2 = (C*2) * max(X,Y)
plan3 = (C*2) * X + B*(Y-X)
plan4 = (C*2) * Y + A*(Y-X)

if X <= Y:
  print(min(plan1,plan2,plan3))
else:
  print(min(plan1,plan2,plan4))
a, b, c, x, y = map(int, input().split())

price = 0

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


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

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

print(TotalPrice)
a,b,ab,x,y=map(int,input().split())
ans=0
abcnt=min(x,y)

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

else:
    ans+=x*a+y*b
print(ans)
A,B,C,X,Y = map(int, input().split())

n = min(X,Y)

sum = 0

sum = min(n*2*C, A*n+B*n)

if X>Y:
    n = X-n
    sum = sum + n*A
else:
    n = Y - n
    sum = sum + n*B

s = (X+Y)*2*C

if sum>s:
    print(s)
else:
    print(sum)
#<全探索>
#<ABC95C>
A,B,C,X,Y = map(int,input().split())
ans1 = A*X + B* Y
ans2=0
if X > Y:
    ans2= C * 2 * Y + A * (X-Y)
else:
    ans2= C * 2 * X + A * (Y-X)
ans3 = 0
if X > Y:
    ans3 = C * 2 * X
else:
    ans3 = C * 2 * Y
    
print(min(ans1,ans2,ans3))
A,B,C,X,Y = map(int,input().split())
X_piza = X
Y_piza = Y
minimum = 10**20
for i in range(0,10**5+2,2):
  if minimum>C*2*i+max(0,X-i)*A+max(0,Y-i)*B:
    minimum = C*2*i+max(0,X-i)*A+max(0,Y-i)*B
print(minimum)
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 5
for i in range(max(x,y)):
    p = 0
    p += c * i
    p += a * (max(0,x - i))
    p += b * (max(0,y - i))
    ans = min(ans,p)
print(ans)
A, B, C, X, Y = map(int, input().split())

ans = 0

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

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