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

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)

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)

-    n = c * i * 2 + max(0, x - i) * a + max(0, y - i) * b +    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