"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.
[{"code": "a,b,c,x,y = list(map(int,input().split()))\n\nif (a + b) <= 2 * c:\n  print((a * x + b * y))\nelse:\n  max_c = max(x,y)\n  min_c = min(x,y)\n  AB = 2 * c * max_c\n  if x > y:\n    SP = ((x - min_c) * a) + (2 * c * min_c)\n  else:\n    SP = ((y - min_c) * b) + (2 * c * min_c)\n  print((min(AB,SP)))\n", "passed": true, "time": 0.23, "memory": 14140.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\nans = float('INF')\nfor k in range(0, 2*max(X, Y)+1, 2):\n  i = max(0, X - int(k/2))\n  j = max(0, Y - int(k/2))\n  ans = min(ans, A*i + B*j + C*k)\nprint(ans)", "passed": true, "time": 0.27, "memory": 14172.0, "status": "done"}, {"code": "# import itertools\n# import math\n# from functools import reduce\n# import sys\n# sys.setrecursionlimit(500*500)\n# import numpy as np\n# import heapq\n# from collections import deque\n\n# N = int(input())\n# S = input()\n# n, *a = map(int, open(0))\nA, B, C, X, Y = map(int, input().split())\n# A = list(map(int, input().split()))\n# B = list(map(int, input().split()))\n# tree = [[] for _ in range(N + 1)]\n# B_C = [list(map(int,input().split())) for _ in range(M)]\n# S = input()\n\n# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])\n# all_cases = list(itertools.permutations(P))\n# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))\n# itertools.product((0,1), repeat=n)\n\n# A = np.array(A)\n# cum_A = np.cumsum(A)\n# cum_A = np.insert(cum_A, 0, 0)\n\n# def dfs(tree, s):\n#     for l in tree[s]:\n#         if depth[l[0]] == -1:\n#             depth[l[0]] = depth[s] + l[1]\n#             dfs(tree, l[0])\n# dfs(tree, 1)\n\n# def factorization(n):\n#     arr = []\n#     temp = n\n#     for i in range(2, int(-(-n**0.5//1))+1):\n#         if temp%i==0:\n#             cnt=0\n#             while temp%i==0:\n#                 cnt+=1\n#                 temp //= i\n#             arr.append([i, cnt])\n#     if temp!=1:\n#         arr.append([temp, 1])\n#     if arr==[]:\n#         arr.append([n, 1])\n#     return arr\n\n# def gcd_list(numbers):\n#     return reduce(math.gcd, numbers)\n\n# if gcd_list(A) > 1:\n#     print(\"not coprime\")\n#     return\n\n# \u9ad8\u901f\u7d20\u56e0\u6570\u5206\u89e3\u6e96\u5099\n#MAXN = 10**6+10\n#sieve = [i for i in range(MAXN+1)]\n#p = 2\n#while p*p <= MAXN:\n#    if sieve[p] == p:\n#        for q in range(2*p, MAXN+1, p):\n#            if sieve[q] == q:\n#                sieve[q] = p\n#    p += 1\n\nif 2 * C > A + B:\n    print(A * X + B * Y)\nelse:\n    if X > Y:\n        print(min(2 * C * X, 2 * C * Y + A * (X - Y)))\n    else:\n        print(min(2 * C * Y, 2 * C * X + B * (Y - X)))", "passed": true, "time": 0.36, "memory": 14208.0, "status": "done"}, {"code": "A,B,C,X,Y,=list(map(int,input().split()))\nans=10000000000000\nfor i in range(0,max(X,Y)+1):\n    ans=min(ans,2*i*C+max(0,X-i)*A+max(0,Y-i)*B)\nprint(ans)\n", "passed": true, "time": 0.42, "memory": 14252.0, "status": "done"}, {"code": "import sys\n\ninput = sys.stdin.readline\na, b, c, x, y= map(int, input().split())\nab = 2*c\ncount_x = 0\ncount_y = 0\nbuy_a = 0\nbuy_b = 0\nbuy_c = 0\n\nif ab < a+b:\n    min_count = min(x,y)\n    count_x = min_count\n    count_y = min_count\n    buy_c = 2*min_count\n    if x - count_x > 0:\n        if ab > a:\n            buy_a += x - count_x\n        else:\n            buy_c += 2 * (x - count_x)\n    \n    elif y - count_y > 0:\n        if ab > b:\n            buy_b += y - count_y\n        else:\n            buy_c += 2*(y - count_y)\nelse:\n    min_count = min(x,y)\n    if min_count == x:\n        buy_a = min_count\n        if ab > b:\n            buy_b += y\n        else:\n            buy_c += 2 * y\n    else:\n        buy_b = min_count\n        if ab > a:\n            buy_a += x\n        else:\n            buy_c += 2 * x\n\nprint(buy_a * a + buy_b * b + buy_c * c)", "passed": true, "time": 0.25, "memory": 14248.0, "status": "done"}, {"code": "A,B,C,X,Y = list(map(int,input().split()))\n\nresult = []\n\nif X > Y:\n    result.append(A * X + B * Y + C * 0)\n    result.append(A * (X - Y) + B * 0 + C * 2 * min(X,Y))\n    result.append(A * 0 + B * 0 + C * 2 * max(X,Y))\nelif X < Y:\n    result.append(A * X + B * Y + C * 0)\n    result.append(A * 0 + B * ( Y - X ) + C * 2 * min(X,Y))\n    result.append(A * 0 + B * 0 + C * 2 * max(X,Y))\nelse:\n    result.append(A * X + B * Y + C * 0)\n    result.append(A * 0 + B * 0 + C * 2 * max(X,Y))\n\nprint((min(result)))\n", "passed": true, "time": 0.15, "memory": 14092.0, "status": "done"}, {"code": "a,b,c,X,Y = map(int,input().split())\n\nmin1 = 10**10\nfor z in range(0,200001,2):\n    x = max(0,X-z//2)\n    y = max(0,Y-z//2)\n    min1 = min(min1,a*x + b*y + c*z)\n\nprint(min1)", "passed": true, "time": 0.5, "memory": 14288.0, "status": "done"}, {"code": "def LI():\n    return list(map(int, input().split()))\na,b,c,x,y = LI()\n\n\nans = float('INF')\n\nfor i in range(max(x,y)+1):\n    ans = min(ans, a*max(0, x-i) + b*max(0, y-i) + c*2*i)\n\nprint(ans)", "passed": true, "time": 0.39, "memory": 14084.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nans1 = x * a + y * b\n\nmin_xy = min(x, y)\nans2 = min_xy * 2 * c + (x - min_xy) * a + (y - min_xy) * b\n\nmax_xy = max(x, y)\nans3 = max_xy * 2 * c\n\nprint(min(ans1, ans2, ans3))", "passed": true, "time": 0.28, "memory": 14072.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\n\nans =0\n\nif A + B > 2 * C:\n    ans += 2 * C * min(X,Y) \n    if X > Y:\n        ans += (X-Y) * min(2*C, A)\n    else:\n        ans += (Y-X) *min(2*C, B)\nelse:\n    ans = A * X + B* Y\nprint(ans)", "passed": true, "time": 0.33, "memory": 14084.0, "status": "done"}, {"code": "a, b, c, x, y = map(int,input().split())\n\nmast = max(x,y)\nans = float('INF')\n\nfor i in range(mast+1):\n    price = a * max(x-i,0) + b * max(y-i,0) + c *2 *i\n    ans =min(ans,price) \n    \nprint(ans)", "passed": true, "time": 0.3, "memory": 14184.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\n\nif a+b<=2*c:\n    print(a*x+b*y)\nelse:\n    if x<=y:\n        if b<=2*c:\n            print(2*c*x+b*(y-x))\n        else:\n            print(2*c*y)\n    else:\n        if a<=2*c:\n            print(2*c*y+(x-y)*a)\n        else:\n            print(2*c*x)", "passed": true, "time": 0.23, "memory": 14292.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nif x > y:\n    cost = min(x*a+y*b, max(x, y)*2*c, y*2*c + (x-y)*a)\nelse:\n    cost = min(x*a+y*b, max(x, y)*2*c, x*2*c + (y-x)*b)\n\nprint(cost)", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nA_B = (a*x)+(b*y)\nAB = 2*c*max(x, y)\n\nif x == y:\n    C = c*2*x\nelif x > y:\n    C = (c*2*y) + a*(x-y)\nelse:\n    C = (c*2*x) + b*(y-x)\n\nprint(min(A_B, AB, C))", "passed": true, "time": 0.23, "memory": 14284.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\ndef II(): return int(input())\ndef MII(): return list(map(int, input().split()))\ndef LII(): return list(map(int, input().split()))\n\ndef main():\n    A, B, C, X, Y = MII()\n\n    ans = A * X + B * Y\n    for i in range(0, max(X, Y)+1):\n        ans = min(ans, max(A * (X - i), 0) + max(B * (Y - i), 0) + C * 2 * i)\n\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.36, "memory": 14164.0, "status": "done"}, {"code": "import math\n\nA, B, C, X, Y = map(int, input().split())\n\nans = A * X + B * Y\n\nif (A + B) / 2 < C:\n    pass\nelse:\n    for i in range(max(X * 2, Y * 2)+1):\n        j = max(0, X - int(i / 2))\n        k = max(0, Y - int(i / 2))\n\n        ans = min(ans, i * C + j * A + k * B)\n\nprint(ans)", "passed": true, "time": 0.31, "memory": 14088.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\nif a+b<=2*c:\n    print(a*x+b*y)\nelse:\n    print(c*2*min(x,y)+min(max(a*(x-y),b*(y-x)),c*2*abs(x-y)))", "passed": true, "time": 0.2, "memory": 14288.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\nn = a * x + b * y\nm = 2 * c * max(x, y)\n\np = b if x < y else a\nl = 2 * c * min(x, y) + p * abs(x-y)\n\nans = min(n, min(m, l))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "a,b,c,x,y=list(map(int,input().split()))\n\n\nmoneys=[]\nfor i in range(0,max(x,y)*2+1,2):\n    apizza=x-int(i/2)\n    bpizza=y-int(i/2)\n    if apizza<0:\n        apizza=0\n    if bpizza<0:\n        bpizza=0\n    money=apizza*a+bpizza*b+i*c\n    moneys.append(money)\n\nprint((min(moneys)))\n", "passed": true, "time": 0.29, "memory": 17312.0, "status": "done"}, {"code": "a_price,b_price,ab_price,num_a,num_b = list(map(int, input().split()))\ntotal = 0\n\nif a_price + b_price < 2 * ab_price:\n\ttotal = a_price * num_a + b_price * num_b\n\nelif a_price + b_price >= 2 * ab_price:\n\tif num_a >= num_b:\n\t\tif a_price > ab_price * 2:\n\t\t\ttotal = ab_price * 2 * num_a\n\t\telse:\n\t\t\ttotal = ab_price * 2 * num_b + a_price * (num_a - num_b)\n\telse:\n\t\tif b_price > ab_price * 2:\n\t\t\ttotal = ab_price * 2 * num_b\n\t\telse:\n\t\t\ttotal = ab_price * 2 * num_a + b_price * (num_b - num_a)\n\nprint(total)\n\n", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "A,B,C,X,Y = map(int,input().split())\nsumAB = A+B\nif sumAB >= 2*C:\n    minXY = min(X,Y)\n    ans = min(X,Y)*2*C\n    X -= minXY\n    Y -= minXY\n    if X != 0:\n        ans += X*min(A,2*C)\n    elif Y !=0:\n        ans += Y*min(B,2*C)\n    print(ans)\n\nelse:\n    print(A*X+Y*B)", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\nans = 2*(5000*10**5)\nfor Z in range(10**5+1):\n    total = A*max(X-Z, 0)+B*max(Y-Z, 0)+2*C*Z\n    ans = min(total,ans)\nprint(ans)", "passed": true, "time": 0.32, "memory": 14096.0, "status": "done"}, {"code": "def slove():\n    A,B,C,X,Y = map(int,input().split())\n    \"\"\"\n    possible combinations are below.\n        A * x + B * y   \n        if x < y: B * abs(x-y) + C * min(x,y) * 2\n        if x > y: A * abs(x-y) + C * min(x,y) * 2\n        C * max(x,y) * 2\n    \"\"\"\n    ans1 = A * X + B * Y\n    if X<Y:\n        ans2 = B * abs(X-Y) + C * 2 * min(X,Y)\n    else:\n        ans2 = A * abs(X-Y) + C * 2 * min(X,Y)\n    \n    ans3 = C * 2 * max(X,Y)\n    print(min(ans1,ans2,ans3)) \n\ndef __starting_point():\n    slove()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "\nA,B,C,X,Y = list(map(int, input().split()))\n\nans1 = (2*C)*min(X,Y) + A*(X-min(X,Y)) + B*(Y-min(X,Y))\nans2 = A*X + B*Y\nans3 = 2*C*max(X,Y)\n\nans = min(ans1,ans2,ans3)\nprint(ans)\n\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "###########\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\na, b, c, x, y = map(int,input().split())\n\nn = a*x+b*y\nm = c * 2 * max(x,y)\np = a if x>y else b\nl = c*2*min(x,y)+p*abs(x-y)\nans = min(n,min(m,l))\n\nprint(ans)", "passed": true, "time": 0.21, "memory": 14080.0, "status": "done"}, {"code": "l = list(map(int, input().split()))\nA, B, C, X, Y = l[0], l[1], l[2], l[3], l[4]\ns_1, s_2, s_3 = 0, 0, 0\n\ns_1 = A*X + B*Y\n\nmaxv = max([X, Y])\ns_2 = 2*C*max([X, Y])\nif X >= Y:\n    s_3 = 2*C*Y + A*(X-Y)\nelse:\n    s_3 = 2*C*X + B*(Y-X)\n\nprint((min([s_1, s_2, s_3])))\n", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "\n\nA, B, C, X, Y = list(map(int,input().split()))\n\nans = 0\n\nab_total =  (C*2) * max(X,Y)\n\nif C*2 < A+B:\n    ans += min(X,Y) * (C*2)\n    if X > Y:\n        ans += (X - Y) * A\n    else:\n        ans += (Y - X)  * B\nelse:\n    ans = A*X + B*Y\n\nif ab_total < ans:\n    print(ab_total)\nelse:\n    print(ans)\n", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "\n\n\na,b,c,x,y = list(map(int,input().split()))\n\nprice = a * x + b * y\n\n\nfor i in range(max(x,y) + 1):\n    ab = 2 * i\n    cand = ab * c + a * max(0, x - i) + b * max(0, y-i)\n\n    price = min(price, cand)\n\nprint(price)\n  \n", "passed": true, "time": 0.2, "memory": 14300.0, "status": "done"}, {"code": "import math\na, b, c, x, y = list(map(int, input().split(' ')))\nans = float('inf')\nc = c*2\nfor i in range(max(x, y)+1):\n    ans = min(ans, a*max(0, x-i)+b*max(0,y-i)+c*i)\nprint(ans)\n", "passed": true, "time": 0.2, "memory": 14088.0, "status": "done"}, {"code": "#n = int(input())\na, b, c, x, y = list(map(int, input().split()))\n#al = list(map(int, input().split()))\n#al=[list(input()) for i in range(n)]\nmn = a*x+b*y\nfor i in range(0, max(x, y)+1):\n    mn = min(mn, max(x-i, 0)*a+max(y-i, 0)*b+2*i*c)\nprint(mn)\n", "passed": true, "time": 0.2, "memory": 14084.0, "status": "done"}, {"code": "A,B,C,X,Y = map(int,input().split())\nmoneys = []\n\nfor i in range(0,2*max(X,Y)+1,2):\n  if X-i//2 >= 0 and Y-i//2 >= 0:\n    moneys.append((X-i//2)*A + (Y-i//2)*B + C*i)\n  elif X-i//2 >= 0 and Y-i//2 < 0:\n    moneys.append((X-i//2)*A + C*i)\n  elif X-i//2 < 0 and Y-i//2 >= 0:\n    moneys.append((Y-i//2)*B + C*i)\n  else:\n    moneys.append(C*i)\n    \nprint(min(moneys))", "passed": true, "time": 0.26, "memory": 17280.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\nans = 10 ** 9\n\nfor c in range(max(X, Y)+1):\n    a = max(X - c, 0)\n    b = max(Y - c, 0)\n\n    cost = A * a + B * b + C * 2 * c\n    ans = min(cost, ans)\n\nprint(ans)", "passed": true, "time": 0.2, "memory": 14068.0, "status": "done"}, {"code": "a,b,c,x,y = map(int,input().split())\n\npiza_min = min(x,y)\n\nplan1 = c*piza_min*2 + a*(x-piza_min) + b*(y-piza_min)\nplan2 = a*x + b*y\nplan3 = c*max(x,y)*2\n\nprint(min(plan1,plan2,plan3))", "passed": true, "time": 0.82, "memory": 14292.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\nif (a+b)>2*c:\n    if x>y:\n        if a>2*c:\n            print(y*2*c+(x-y)*c*2)\n        else:\n            print(y*2*c+(x-y)*a)\n\n    else:\n        if b>2*c:\n            print(x*2*c+(y-x)*c*2)\n        else:\n            print(x*2*c+(y-x)*b)\nelse:\n    print(x*a+y*b)", "passed": true, "time": 0.45, "memory": 14244.0, "status": "done"}, {"code": "a,b,c,x,y = list(map(int, input().split()))\n\nm = min(x,y)\nc2 = min(a+b, 2*c)\nans = c2*m\nx -= m\ny -= m\nif x:\n  ans += min(a, 2*c)*x\nif y:\n  ans += min(b, 2*c)*y\nprint(ans)\n", "passed": true, "time": 0.88, "memory": 14080.0, "status": "done"}, {"code": "a,b,c,x,y = list(map(int, input().split()))\nans = int(1e9)\nfor i in range(max(x,y)*2+1):\n    ans = min(ans, c*i+a*max(0, x-i//2)+b*max(0, y-i//2))\n\nprint(ans)\n", "passed": true, "time": 0.95, "memory": 14292.0, "status": "done"}, {"code": "a,b,c,x,y = list(map(int,input().split()))\nif x<y:\n    a,b,x,y=b,a,y,x\n\nif a+b<2*c:\n    ans=a*x+b*y\nelse:\n    if a>2*c:\n        ans = c*2*x\n    else:\n        ans = c*2*y + a*(x-y)\nprint(ans)\n", "passed": true, "time": 0.25, "memory": 14292.0, "status": "done"}, {"code": "a, b, c, x, y = list(map(int, input().split()))\nsum = a + b\nif x > y:\n    cost = a\nelse:\n    cost = b\n\n\nif sum > 2 * c:\n    if x == y:\n        total = 2 * x * c\n        pass\n    else:\n        total = 2 * min(x, y) * c\n        num = (max(x, y)-min(x, y))\n        if cost * num < 2 * num * c:\n            total += cost * num\n        else:\n            total += 2 * num * c\n\nelif sum == 2 * c:\n    if x == y:\n        total = x * 2 * c\n        pass\n    else:\n        total = min(x, y) * 2 * c\n        num = (max(x, y)-min(x, y))\n        if cost * num < 2 * c * num:\n            total += cost * num\n        else:\n            total += num * 2 * c\nelse:\n    total = a * x + b * y\n\nprint(total)\n", "passed": true, "time": 0.25, "memory": 14192.0, "status": "done"}, {"code": "a, b, c, x, y = list(map(int, input().split()))\n\nans = [a * x + b * y]\n\nif x >= y:\n    ans.append(2 * c * y + (x - y) * a)\n    ans.append(2 * c * x)\nelse:\n    ans.append(2 * c * x + (y - x) * b)\n    ans.append(2 * c * y)\n\nprint((min(ans)))\n", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\nans = 0\nans += 2*c*min(x, y)\nif x < y:\n  ans += (y-x)*b\nelse:\n  ans += (x-y)*a\n\nans = min(ans, a*x+b*y)\nprint(min(ans, 2*c*max(x, y)))", "passed": true, "time": 0.15, "memory": 14224.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\ndpr=min(A+B,2*C)\nApr=min(A,2*C)\nBpr=min(B,2*C)\n\ndam=dpr*min(X,Y)\nif X>=Y:\n  sam=Apr*(X-Y)\nelse:\n  sam=Bpr*(Y-X)\n  \nprint(dam+sam)", "passed": true, "time": 0.14, "memory": 14228.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\nans = 5000 * 1000000\nfor i in range(0, max(X, Y)*2 + 1, 2): \n        x = max(0, X - i//2)\n        y = max(0, Y - i//2)\n        ans = min(ans, A*x + B*y + C*i)\nprint(ans)", "passed": true, "time": 0.36, "memory": 14088.0, "status": "done"}, {"code": "# C - Half and Half\nA,B,C,X,Y = map(int,input().split())\n\n# AB \u30d4\u30b6\u3092\u8cb7\u308f\u306a\u3044\u5834\u5408\npay1 = X*A + Y*B\n# A \u30d4\u30b6 \u3092 AB \u30d4\u30b6\u3067\u4f5c\u308b\u5834\u5408\npay2 = 10**10\nif Y >= X:\n    pay2 = C*2*X + B*(Y-X)\n# B \u30d4\u30b6\u3092 AB \u30d4\u30b6\u3067\u4f5c\u308b\u5834\u5408\npay3 = 10**10\nif X >= Y:\n    pay3 = A*(X-Y) + C*2*Y\n# AB \u30d4\u30b6\u3067\u5168\u90e8\u4f5c\u308b\u5834\u5408\npay4 = C*max(X,Y)*2\nprint(min(pay1,pay2,pay3,pay4))", "passed": true, "time": 0.15, "memory": 14336.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\nprice = 0\n\nm = min(A + B , C * 2)\nn = min(X, Y)\nprice += m * n\n\nd = max(X, Y) - min(X, Y)\nif d != 0:\n    if X > Y:\n        price += min(A, C * 2) * d\n    else:\n        price += min(B, C * 2) * d\n\nprint(price)", "passed": true, "time": 0.15, "memory": 14104.0, "status": "done"}, {"code": "3\n#coding: utf-8\n\nA, B, C, X, Y = (int(x) for x in input().split())\n\nret = 0\nif A + B > C * 2:\n    m = min(X, Y)\n    X -= m\n    Y -= m\n    ret += m * C * 2\n\nif X > 0:\n    if A > C * 2:\n        ret += X * C * 2\n    else:\n        ret += X * A\n\nif Y > 0:\n    if B > C * 2:\n        ret += Y * C * 2\n    else:\n        ret += Y * B\n\nprint(ret)\n", "passed": true, "time": 0.15, "memory": 14328.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\n\nab = min(2*C, A+B)\na = min(2*C, A)\nb = min(2*C, B)\n\nif X <= Y:\n  ans = X * ab + (Y - X) * b\nelse:\n  ans = Y * ab + (X - Y) * a\nprint(ans)", "passed": true, "time": 0.21, "memory": 14300.0, "status": "done"}, {"code": "A,B,C,X,Y = list(map(int,input().split()))\nif A+B<=2*C:\n  print((A*X+B*Y))\nelse:\n  if X>=Y:\n    if 2*C*Y+A*(X-Y)>=2*C*X:\n      print((2*C*X))\n    else:\n      print((2*C*Y+A*(X-Y)))\n  else:\n    if 2*C*X+B*(Y-X)>=2*C*Y:\n      print((2*C*Y))\n    else:\n      print((2*C*X+B*(Y-X)))\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\np = a*x + b*y\nq = 2*c*max(x,y)\nr = 2*c*x + b*(y-x)\ns = 2*c*y + a*(x-y)\nif x >=y:\n        print(min(p,q,s))\nelse:\n        print(min(p,q,r))", "passed": true, "time": 0.22, "memory": 14092.0, "status": "done"}, {"code": "a, b, c, x, y = list(map(int, input().split()))\n\nans = 10**10\nfor i in range(10**5+1):\n    price = a*max(x-i, 0) + b*max(y-i, 0)+ i*2*c \n    ans = min(ans, price)\nprint(ans)\n", "passed": true, "time": 0.31, "memory": 14344.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\n\nans=0\nif C*2<=A+B:\n    mi=min(X,Y)\n    ans=mi*C*2\n    if Y<=X:\n        ans+=min(A*(X-mi),2*C*(X-mi))\n    else:\n        ans+=min(B*(Y-mi),2*C*(Y-mi))\nelse:\n    ans=A*X+B*Y\nprint(ans)", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\nA,B,C,X,Y = list(map(int, input().split()))\n\nans = 10000 * 10**5\nfor z in range(10**5+1):\n    x = max(X-z, 0)\n    y = max(Y-z, 0)\n    yen = A*x + B*y + 2*C*z\n    if ans > yen:\n        ans = yen\n\nprint(ans)\n", "passed": true, "time": 0.28, "memory": 14140.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\nprint(min(a*x+b*y, 2*c*x + b*max(0,y-x), 2*c*y + a*max(0, x-y)))", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\nans = float(\"inf\")\nfor i in range(0, max(X, Y)*2 + 1, 2): \n        x = max(0, X - i//2)\n        y = max(0, Y - i//2)\n        ans = min(ans, A*x + B*y + C*i)\nprint(ans)", "passed": true, "time": 0.21, "memory": 14184.0, "status": "done"}, {"code": "a,b,c,x,y = [int(x) for x in input().split()]\nres = 0\nif a + b > 2 * c:\n  res += min(x,y) * 2 * c\n  if x == min(x,y):\n    if b > 2 * c:\n      res += (y - min(x,y)) * 2 * c\n    else:\n      res += (y - min(x,y)) * b\n  else:\n    if a > 2 * c:\n      res += (x - min(x,y)) * 2 * c\n    else:\n      res += (x - min(x,y)) * a\nelse:\n  res += a * x\n  res += b * y\nprint(res)", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\nans = 10**10\nfor i in range(10**5+1):\n    ans = min(ans, A*max(X-i, 0)+B*max(Y-i, 0)+2*C*i)\nprint(ans)\n", "passed": true, "time": 0.31, "memory": 14220.0, "status": "done"}, {"code": "# C\nA,B,C,X,Y = list(map(int,input().split()))\nans = 0\nif 2*C >= A + B:\n  ans = A*X+B*Y \nelse:\n  x = min(X,Y)\n  ans = min(X,Y)*(2*C)\n  if (X-x)*A + (Y-x)*B > (X+Y-2*x)*(2*C):\n    ans += (X+Y-2*x)*(2*C)\n  else:\n    ans += (X-x)*A + (Y-x)*B\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split(' '))\n\nc = int(c*2)\nm = float('inf')\nfor i in range(10**5+1):\n    m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)\nprint(m)", "passed": true, "time": 0.31, "memory": 14248.0, "status": "done"}, {"code": "a,b,c,x,y = list(map(int, input().split()))\n\nmincost = a*x+b*y\nfor z in range(max(x,y)+1):\n    x_ = max(0, x-z)\n    y_ = max(0, y-z)\n    cost = 2*c*z + a*x_ + b*y_\n    mincost = min(mincost, cost)\n\nprint(mincost)\n", "passed": true, "time": 0.21, "memory": 14220.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nab = a * x + b * y\ncc = c * 2 * max(x, y)\nabcc = c * 2 * min(x, y) + (b if x < y else a) * abs(x - y)\n\nprint(min(ab, cc, abcc))", "passed": true, "time": 0.18, "memory": 14292.0, "status": "done"}, {"code": "def mapt(fn, *args):\n    return tuple(map(fn, *args))\n\n\ndef Input():\n    return mapt(int, input().split(\" \"))\n\n\ndef main():\n    a, b, c, x, y = Input()\n\n    if a + b < c * 2:\n        print(a * x + b * y)\n        return\n\n    if x == y:\n        print(c * x * 2)\n    else:\n        if x > y:\n            temp = x - y\n            print(min(2*c*x, 2*c*y+temp*a))\n        else:\n            temp = y - x\n            print(min(2*c*y, 2*c*x+temp*b))\n\n\nmain()", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "A,B,C,X,Y =map(int,input().split())\nres = 2 * C * max(X,Y)\nif X > Y:\n    res = min(2 * C * Y + (X-Y) * A,res)\nelse:\n    res = min(2 * C * X + (Y-X) * B,res)\nres = min(A*X+B*Y,res)\n\nprint(res)", "passed": true, "time": 0.22, "memory": 14072.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\nprint(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))", "passed": true, "time": 0.25, "memory": 14168.0, "status": "done"}, {"code": "import math\n\nA, B, C, X, Y = list(map(int, input().split()))\n\nmin_sum = A*X+B*Y\nfor c in range(0, (max(X, Y)*2)+1, 2):\n    s = (max(X-math.floor(c/2), 0))*A + (max(Y-math.floor(c/2), 0))*B + c*C\n    if s < min_sum:\n        min_sum = s\nprint(min_sum)\n", "passed": true, "time": 0.32, "memory": 14084.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nif a >= 2*c and b >= 2*c:\n    print(max(x, y) * 2*c)\nelif a >= 2*c:\n    print(x * 2*c + max(0, (y - x) * b))\nelif b >= 2*c:\n    print(y * 2*c + max(0, (x - y) * a))\nelif a + b > 2*c and x < y:\n    print(x * 2*c + (y - x) * b)\nelif a + b > 2*c:\n    print(y * 2*c + (x - y) * a)\nelse:\n    print(x * a + y * b)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "a, b, c, x, y = map(int,input().split())\nans = 1e10\nfor k in range(100010):\n    ans = min(( 2 * c * k + max(x - k, 0) * a + max(y - k, 0) * b ),ans)\nprint(int(ans))", "passed": true, "time": 0.59, "memory": 14308.0, "status": "done"}, {"code": "a,b,c,x,y = map(int, input().split())\n\n# set x >= y\nif x < y: \n    x,y = y,x\n    a,b = b,a\n\nprice_1 = a*x + b*y\nprice_2 = a*(x-y) + 2*c*y\nprice_3 = 2*c*x\n\nprint(min(price_1, price_2, price_3))", "passed": true, "time": 0.22, "memory": 14096.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nres = a*x + b*y\nfor i in range(1, max(x, y)+1):\n    ab = i*2\n    cand = ab*c + a*max(0, x-i) + b*max(0, y-i)\n\n    res = min(res, cand)\n\nprint(res)", "passed": true, "time": 0.3, "memory": 14076.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int, input().split())\nans=A*X+B*Y\na=0\nb=0\n\nfor i in range(1,1+2*max(X,Y)):\n  if X-i/2<0:\n    a=0\n  else:\n    a=X-i/2\n  if Y-i/2<0:\n    b=0\n  else:\n    b=Y-i/2\n  ans = min(ans, A*a+B*b+C*i)\n  \nprint(int(ans))", "passed": true, "time": 0.27, "memory": 14216.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\nresult=[]\nif(x>y):\n    result.append(a*x+b*y)\n    result.append(a*(x-y)+2*c*y)\n    result.append(2*c*x)\nelif(x<y):\n    result.append(a*x+b*y)\n    result.append(b*(y-x)+2*c*x)\n    result.append(2*c*y)\nelse:\n    result.append(a*x+b*y)\n    result.append(2*c*x)\nprint(min(result))", "passed": true, "time": 0.17, "memory": 14128.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\ndif = abs(X - Y)\nrem = max(X, Y)\nif rem == X:\n    E = A\nelse:\n    E = B\n\ncom = rem - dif\nans = 0\n\nD = A + B\nif D < C * 2:\n    ans += D * com\nelse:\n    ans += C * com * 2\n\nif E < C * 2:\n    ans += E * dif\nelse:\n    ans += C * dif * 2\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\nmini = float('inf')\n\nfor i in range(10**6 + 1):\n    calc = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B\n    if calc < mini:\n        mini = calc\n\nprint(mini) ", "passed": true, "time": 1.65, "memory": 14280.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\nif A+B<2*C:\n  ans=A*X+B*Y\nelse:\n  if X<=Y:\n    ans=C*2*X\n    if 2*C<=B:\n      ans+=2*C*(Y-X)\n    else:\n      ans+=B*(Y-X)\n  else:\n    ans=C*2*Y\n    if 2*C<=A:\n      ans+=2*C*(X-Y)\n    else:\n      ans+=A*(X-Y)\nprint(ans)", "passed": true, "time": 0.22, "memory": 14108.0, "status": "done"}, {"code": "a,b,c,x,y = map(int,input().split())\nans = 0\nab = min(a+b,c*2)\ntemp = min(x,y)\nans += ab*temp\nx -= temp\ny -= temp\nans += min(a,c*2)*x \nans += min(b,c*2)*y\nprint(ans)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\nans = 10000000000\ncost = 0\n\n# C for both A and B\ncost = max(X, Y) * C * 2\nans = min(ans, cost)\n\nif X > Y:\n    cost = Y * C * 2\n    cost1 = cost + (X - Y) * A\n    cost2 = cost + (X - Y) * C * 2\n    cost = min(cost1, cost2)\n    ans = min(ans, cost)\nelse:\n    cost = X * C * 2\n    cost1 = cost + (Y - X) * B\n    cost2 = cost + (Y - X) * C * 2\n    cost = min(cost1, cost2)\n    ans = min(ans, cost)\n\ncost = A * X + B * Y\nans = min(ans, cost)\n\nprint(ans)", "passed": true, "time": 0.15, "memory": 14332.0, "status": "done"}, {"code": "a, b, c, x, y = map(int,input().split())\nif x >= y:\n  ans = min(a*x + b*y, a*(x-y) + 2*c*y, 2*c*x)\nelse:\n  ans = min(a*x + b*y, b*(y-x) + 2*c*x, 2*c*y)\nprint(ans)", "passed": true, "time": 0.15, "memory": 14072.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\nans = 0\nif a+b >= c*2:\n    ans = min(x,y)*c*2\n    if x>y:\n        if a > c*2:\n            ans += c*2*(x-y)\n        else:\n            ans += a*(x-y)\n    else:\n        if b > c*2:\n            ans += c*2*(y-x)\n        else:\n            ans += b*(y-x)\n\nelse:\n    ans = a*x+b*y\nprint(ans)", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n    a,b,c,x,y = map(int,input().split())\n    ans1=99999999999999999999999999\n    if a+b>2*c:\n        if x > y:\n            ans1=2*c*y+a*(x-y)\n        elif y > x:\n            ans1=2*c*x+b*(y-x)\n    ans2=c*2*max(x,y)\n    ans3=a*x+b*y\n    print(min(ans1,ans2,ans3))\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\n\nans = float(\"inf\")\nfor c in range(200_001):\n    cost = c * C\n    cost += A * max(0, X - c // 2)\n    cost += B * max(0, Y - c // 2)\n    ans = min(ans, cost)\nprint(ans)\n", "passed": true, "time": 0.53, "memory": 14228.0, "status": "done"}, {"code": "A,B,C,X,Y = map(int,input().split())\nmin_xy = min(X,Y)\nmax_xy = max(X,Y)\nans1 = 2*C*min_xy + A*(X-min_xy)+B*(Y-min_xy)\nans2 = A*X+B*Y\nans3 = 2*C*max_xy\nprint(min(ans1,ans2,ans3))", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}, {"code": "a,b,c,x,y = list(map(int, input().split()))\n\nans = a*x + b*y\nfor i in range(1, max(x,y)+1):\n    C = 2*i*c + a*max(0,x-i) + b*max(0,y-i)\n    ans = min(ans, C)\nprint(ans)\n", "passed": true, "time": 0.28, "memory": 14184.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int,input().split()))\n\nmin_p = 100000000000000\nfor c in range(0, max(X, Y)*2+1):\n    a = X - int(c / 2)\n    b = Y - int(c / 2)\n\n    if a < 0 :\n        a = 0\n    if b < 0:\n        b = 0\n\n    p = A*a+B*b+C*c\n    min_p = min(min_p, p)\nprint(min_p)\n", "passed": true, "time": 0.41, "memory": 14088.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\n\nanswer = 7000000000\nfor i in range(100001):\n  amount = i*2*c + max(0, x-i)*a + max(0, y-i)*b\n  if answer > amount:\n    answer = amount\nprint(answer)", "passed": true, "time": 0.29, "memory": 14204.0, "status": "done"}, {"code": "a, b, c, x, y = list(map(int, input().split()))\nmmin = -1\n\n\ndef maxint(x, y: int) -> int:\n    if x > y:\n        return x\n    else:\n        return y\n\n\nmax = maxint(x, y)\nfor i in range(0, max+1):\n    tmp = 2*c*i + a*(maxint(0, x-i))+b*(maxint(0, y-i))\n    if mmin == -1:\n        mmin = tmp\n        continue\n    if tmp < mmin:\n        mmin = tmp\nprint(mmin)\n", "passed": true, "time": 0.3, "memory": 14312.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\nimport math\nsaishou = math.inf\n\ntemp = 0\n\nfor i in range (0, X+1):\n\ttemp = A*i+C*2*(X-i)\n\tif X-i < Y:\n\t\tif 2*C <= B:\n\t\t\ttemp+=2*C*(Y-(X-i))\n\t\telse:\n\t\t\ttemp+=B*(Y-(X-i))\n\tif saishou > temp:\n\t\tsaishou = temp\n                      \nprint(saishou)", "passed": true, "time": 0.17, "memory": 14056.0, "status": "done"}, {"code": "a, b, c, x, y = list(map(int, input().split()))\n\nc *= 2\nt = 0\n\nif a+b > c:\n  v = min([x,y])\n  t = v * c\n  x, y = x-v, y-v\n\n  if x>0:\n    if a<c:\n      t = t + a*x\n    else:\n      t = t + c*x\n  elif y>0:\n    if b<c:\n      t = t + b*y\n    else:\n      t = t + c*y\nelse:\n  t = a*x + b*y\n\nprint(t)\n", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "a, b, c, x, y = map(int, input().split())\nif x > y:\n    cost = min(a*x + b*y, x*c*2, y*c*2 + (x-y)*a)\nelse:\n    cost = min(a*x + b*y, y*c*2, x*c*2 + (y-x)*b)\n\nprint(cost)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int,input().split())\nans = float('inf')\nfor i in range(0, max(X,Y)+1):\n  num = i*2*C + max(0, X-i)*A + max(0, Y-i)*B\n  ans = min(ans, num)\nprint(ans)", "passed": true, "time": 0.31, "memory": 14084.0, "status": "done"}, {"code": "a,b,c,x,y = map(int,input().split())\nans = 0\nif a >= c*2:\n  y -= x\n  ans += c*2*x\n  x = 0\nif b >= c*2 and y > 0:\n  ans += c*2*y\n  x -= y\n  y = 0\nelif a+b >= c*2:\n  t = min(max(x,0),max(y,0))\n  x -= t\n  y -= t\n  ans += t*2*c\nif y > 0:\n  ans += b * y\nif x > 0:\n  ans += a*x\nprint(ans)", "passed": true, "time": 0.23, "memory": 14120.0, "status": "done"}, {"code": "a,b,c,x,y = map(int,input().split())\nc *= 2\nans = 10 ** 16\nfor i in range(max(x,y)+1):\n    m = 0\n    m += (a*(max(0,x-i)))+(b*(max(0,y-i)))+(c*i)\n    ans = min(ans,m)\nprint(ans)", "passed": true, "time": 0.2, "memory": 14168.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\nans = float('INF')\nfor i in range(0, 2*max(X, Y)+1, 2):\n  ans = min(ans, int(A*max(0, X-i/2)+B*max(0, Y-i/2)+C*i))\nprint(ans)\n", "passed": true, "time": 0.35, "memory": 14268.0, "status": "done"}, {"code": "import sys\ndef readint():\n    return int(sys.stdin.readline())\n\ndef readints():\n    return tuple(map(int,sys.stdin.readline().split()))\n\ndef readintslist(n):\n    return [tuple(map(int,sys.stdin.readline().split())) for _ in range(n)]\n\ndef main():\n    a,b,c,x,y = readints()\n\n    a_pizza = [a*i for i in range(x+1)]\n    b_pizza = [b*i for i in range(y+1)]\n    ab_pizza = [2*c*i for i in range(max(x,y)+1)]\n\n    ans = []\n    for i in range(max(x,y)+1):\n        ans.append(a_pizza[max(x-i,0)]+b_pizza[max(y-i,0)]+ab_pizza[i])\n    print(min(ans))\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.21, "memory": 28584.0, "status": "done"}, {"code": "A, B, C, X, Y = map(int, input().split())\n\nans = max(A, B, C) * (X + Y)\nfor i in range(max(X, Y) * 2 + 1):\n    price = i * C\n    price += max(X - i//2, 0) * A\n    price += max(Y - i//2, 0) * B\n    ans = min(ans, price)\n    # print(i, X-i//2, Y-i//2, price, ans)\nprint(ans)", "passed": true, "time": 0.27, "memory": 14092.0, "status": "done"}, {"code": "import math\na, b, c, x, y = map(int, input().split(' '))\nans = float('inf')\nc = c*2\nfor i in range(max(x, y)+1):\n    if i > x:\n        price = b*(y-i) + c*i\n    elif i > y:\n        price = a*(x-i) + c*i\n    else:\n        price = a*(x-i) + b*(y-i) + c*i\n\n    if ans > price:\n        ans = price\nprint(ans)", "passed": true, "time": 0.16, "memory": 14180.0, "status": "done"}, {"code": "a,b,c,x,y=map(int,input().split())\np = a*x + b*y\nq = 2*c*max(x,y)\nr = 2*c*x + b*(y-x)\ns = 2*c*y + a*(x-y)\nif x >=y:\n        print(min(p,q,s))\nelse:\n        print(min(p,q,r))", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "a,b,c,x,y = map(int,input().split())\nans = 0\nif a >= c*2:\n  y -= x\n  ans += c*2*x\n  x = 0\nif b >= c*2 and y > 0:\n  ans += c*2*y\n  x -= y\n  y = 0\nelif a+b >= c*2:\n  t = min(max(x,0),max(y,0))\n  x -= t\n  y -= t\n  ans += t*2*c\nif y > 0:\n  ans += b * y\nif x > 0:\n  ans += a*x\nprint(ans)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\nif 2*C <= A+B:\n  price= 2*C\nelse:\n  price = A+B\nmaxN = max(X,Y)\nminiN = min(X,Y)\nres = miniN * price\nresidue = maxN - miniN\nif residue == 0:\n  print(res)\nelif X > Y:\n  res+= min(residue*A, residue*2*C)\n  print(res)\nelif Y > X:\n  res +=  min(residue*B, residue*2*C)\n  print(res)", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "A,B,C,X,Y = map(int,input().split())\nans = 10**10\nfor k in range(max(X,Y)+1):\n    i = max((X-k),0)\n    j = max((Y-k),0)\n    price = A*i + B*j + C*2*k\n    ans = min(ans,price)\n\nprint(ans)", "passed": true, "time": 0.33, "memory": 14164.0, "status": "done"}, {"code": "A, B, C, X, Y = list(map(int, input().split()))\n\nif A+B <= 2*C:\n    print((A*X+B*Y))\nelse:\n    if X <= Y:\n        print((min(2*C*Y, 2*C*X+B*(Y-X))))\n    else:\n        print((min(2*C*X, 2*C*Y+A*(X-Y))))\n", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "# coding: utf-8\n\n\ndef main():\n    A, B, C, X, Y = list(map(int, input().split()))\n    ans = 0\n    min_p = min(X, Y)\n    d = X - Y\n\n    if A + B > 2 * C:\n        ans += 2 * C * min_p\n    else:\n        ans += (A + B) * min_p\n\n    if d > 0:\n        if A > 2 * C:\n            ans += 2 * C * d\n        else:\n            ans += A * d\n    elif d < 0:\n        if B > 2 * C:\n            ans += 2 * C * -d\n        else:\n            ans += B * -d\n\n    print(ans)\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14288.0, "status": "done"}, {"code": "A,B,C,X,Y=map(int,input().split())\n\np_A=A*X\np_B=B*Y\ntotal=p_A+p_B\n\nif X>Y:\n\ta=X-Y\n\tab=Y*C*2\n\ttotal_ab=C*X*2\n\ttotal_1=ab+a*A\n\tprint(min(total_1,total,total_ab))\n\nelif X<Y:\n\tb=Y-X\n\tab=X*C*2\n\ttotal_ab=C*Y*2\n\ttotal_2=ab+b*B\n\tprint(min(total_2,total,total_ab))\n\nelif X==Y:\n\tab=C*X*2\n\tprint(min(ab,total))", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}]