peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
x = 1
ans = 0

while ans <= n:
  x += 1
  ans = x**2

print((x-1)**2)
x=int(input())
ans=0
for i in range(32):
  if x>=(i+1)**2:
    ans=(i+1)**2
  else:
    print(ans)
    break
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
X = int(input())

print(int(X**.5)**2)
import math

X = int(input())
if X <= 3:
  print(1)
else:
  ans = 0
  for i in range(2,int(X**0.5)+1):
    p = int(math.log(X,i))
    if p <= 1:
      continue
    ans = max(i**p,ans)
  print(ans)
x = int(input())
ans = 0
for a in range(2, 33):
  for b in range(2, 10):
    if a**b > x:
      break
    ans = max(ans, a**b)
print(ans)
from math import sqrt
from math import floor
from math import log
x=int(input())
ans=[1]
for i in range(2,x+1):
    l=floor(log(x,i))
    if l>1:
        ans.append(i**l)
print(max(ans))
import math

X = int(input())
for x in range(X, 0, -1):
    for y in range(2, x, 1):
        log = math.log(x, y)
        div, mod = divmod(log, 1)
        if mod == 0:
            print(x)
            exit()
import numpy as np
x = int(input())

for i in range(x, 1, -1):
    if(np.sqrt(i) % 1 == 0):
        print(i)
        break
import math

X = int(input())
ans = 0

if X == 1:
  print(1)
  exit()

for i in reversed(range(X)):
  num = int(math.sqrt(i))
  if num ** 2 == i and ans < i:
    ans = i

print(ans)
import math
x = int(input())
for i in range(x,0,-1):
    if math.sqrt(i)%1 == 0:
        print(i)
        break
x = int(input())
r = int(x**0.5)
for i in reversed(range(1, x+1)):
    for j in range(1, r+1):
        for k in range(2, r+1):
            if i == j**k:
                print(i)
                exit()
x=int(input())
l=[1]
for i in range(2,int(x**0.5)+1):
    l.append(int(x**(1/i))**2)

print(max(l))
x=int(input())
ans=[1]
for i in range(2,50):
    y=2
    while i**y<=x:
        ans.append(i**y)
        y+=1
print(ans[-1])
x = int(input())
import math

while True:
  #print(math.sqrt(x))
  if(str(math.sqrt(x))[-2] == "." and str(math.sqrt(x))[-1] == "0"):
    print(x)
    exit()
  else:
    x = x - 1
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

X = int(readline())

ans = 1
while ans * ans <= X:
    ans += 1
print(ans - 1)
import math
x = int(input())

for i in range(1,int(math.sqrt(x))+2):
    if i**2 > x:
        print((i-1)**2)
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.log(i, j).is_integer():
            print(i)
            exit()
n = int(input())
x = 1
ans = 0

while ans < n:
  x += 1
  ans = x**2

print((x-1)**2)
X = int(input())
for i in range(1, 1000):
    if i ** 2 > X:
        print((i-1)**2)
        break
import math
x = int(input())

sq_x = int(x ** 0.5)

ans = 0
for i in range(2, sq_x + 1):
    t = i ** i
    while True:
        t *= i
        if t > x:
            break
        ans = max(ans, t)

print(ans)
x = int(input())
ans = 1
while ans**2 < x:
    ans+=1
print(max((ans-1)**2,1))
N = int(input())
result = 0
for i in range(1,int(N**0.5)+1):
  result = i
print(result ** 2)
n=int(input())
res=1
k=1
for b in range(1,int(n**0.5)+1):
    for p in range(2,n):
        if b**p>n:
            break
        else:
            res=b**p
print(res)
pow = [1]
for p in range(2,32):
  i=1
  while p**i<=1000:
    pow.append(p**i)
    i += 1
#print(pow)
X = int(input())
x = X
while x>0:
  if x in pow:
    ans = x
    break
  x -= 1
print(ans)
import sys
from math import floor

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    x = I()
    ans = 1
    for i in range(2, x):
        temp = floor(x**(1/i))
        if temp == 1:
            break
        ans = max(ans, temp**i)
    print(ans)

if __name__ == '__main__':
    main()
import sys
# input処理を高速化する
input = lambda: sys.stdin.readline().rstrip()

N = int(input())
expo = set()
for i in range(1, 32):
    for j in range(2, 10):
        if i ** j >= 1000:
            break
        expo.add(i ** j)
expo = sorted(list(expo), reverse=True)
for e in expo:
    if e <= N:
        print(e)
        exit()
from math import log, sqrt

X = int(input())
max_num = 1
for i in range(2, int(sqrt(X)) + 1):
    max_num = max(max_num, i ** int(log(X, i)))

print(max_num)
x = int(input())

ans = 1
n = 1

while True:
    if n*n > x:
        break
    else:
        ans = n**2
        n += 1

print(ans)
X = int(input())
ans = 0

for i in range(1, X):
  for j in range(2, X):
    num = i ** j
    if num > X:
      break
    ans = num

print(ans)
X = int(input())

lst = []
for i in range(100):
    for j in range(2,10):
        if i**j >= 1000:
            break
        else:
            lst.append(i**j)

for k in range(X):
    if X - k in lst:
        print(X-k)
        break
X=int(input())
ans=1
for i in range(1000):
  for n in range(1000):
    if i**n<=X:
      ans=i**n
    else:
      break
print(max(ans,X))
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    ans = max(ans, int(pow(i, int(log(x, i)))))
print(ans)
from math import sqrt
X=int(input())
ans=0
for i in range(1,int(sqrt(X))+1):
    now=i
    b=2
    while i!=1:
        if X<=i**b:
            break
        now=i**b
        b+=1
    ans=max(ans, now)
print(ans)
X=int(input())
import math
num = []
for i in range(1,X+1):
    if i == int(math.sqrt(i)) ** 2:
        num.append(i)
print(max(num))
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    X = ini()
    ans = 1
    for p in range(2, X):
        a = p * p
        while a < X:
            ans = max(ans, a)
            a *= p
    return ans


print(solve())
from math import log,floor
X = int(input())
if X < 4:
  print(1)
else:
  answer = 0
  for b in range(2,X):
    if floor(log(X,b)) > 1:
        answer = max(answer,int(b**floor(log(X,b))))
  print(answer)
X=int(input())
numbers=[]
for a in range(1,1001):
    if (a**0.5).is_integer():
        numbers.append(a)
answer=[a for a in numbers if a<=X]
print(max(answer))
n =(int)(input())
ans=0
for i in range(n):
  if i*i <= n:
    ans =i
print(ans)
def main():
    X = int(input())
    ans = 1
    for b in range(1,X+1):
        for p in range(2,10):
            a = b**p
            if a > X:
                break
            elif ans < a and a < X:
                ans = a
    print(ans)

if __name__ == '__main__':
    main()
x = int(input())
l = [1]
for i in range(2,int(x**0.5)+1):
    num = i
    num *= num
    while num < x:
        l.append(num)
        num *= num
print(max(l))
x = int(input())
i = 1
while i * i <= x:
    i += 1
print((i - 1) ** 2)
x = int(input())
y = 0
if x==1:
    print(1)
else:
    for a in range(2,(x+1)):
        for b in range (2,10):
            if b==2 and a**b>x:
                print(y)
            elif a**b<x:
                y=max(a**b,y)
x = int(input())

for i in range(x):
    for j in range(2, 32):
        if (x-i)**(1/j) % 1 == 0:
            print(x-i)
            exit()
import math
x = int(input())

for i in range(x,1,-1):
    if (math.sqrt(i)).is_integer():
        print (i)
        exit ()
x = int(input())
while x >= 1:
    if str(x**(1/2) * 10)[-1] == "0":
        print(x)
        break
    else:
        x -= 1
x = int(input())
ans = [1]
b = 2
p = 2
while b**p < x:
  while b**p<x:
    ans.append(b**p)
    p += 1
  b += 1
  p = 2
print(ans[-1])
x = int(input())
ans = 1

for i in range(2, int(x**(0.5))+1):
  j = 2
  while True:
    k = i**j
    if k > x:
      break
    else:
      ans = max(ans, i)
      j += 1
      
print(ans)
x=int(input())
import math
k=int(math.sqrt(x))
print(k**2)
import math

X = int(input())

if X == 1:
    print(1)
    exit()

for i in reversed(range(1, X+1)):
    for j in range(2, int(math.sqrt(i))+1):
        if math.log(i, j).is_integer():
            print(i)
            exit()
    if i == 1:
        print(1)
x = int(input())
for i in range(x,0,-1):
  if (i ** .5).is_integer():
    print(i)
    break
x = int(input())
ans = 1
for b in range(1, int(1000**.5)+1):
    for p in range(2, 10):
        if b**p <= x:
            ans = b**p
print(ans)
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *

import numpy as np

import math

if __name__ == '__main__':
    n =int(input())
    a = int(math.sqrt(n))

    print(a*a)
x = int(input())
while x >= 1:
    if x**(1 / 2) % 1 == 0:
        print(x)
        break
    else:
        x -= 1
a=int(input())
d=0
for i in range(33):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<c:
    d=c
print(int(d))
X = int(input())
final = 0
for i in range(40):
    for j in range(1,11):
        if i**j > X:
            final = max(ans,final)
            break
        ans = i**j
print(final)
n=input()
l=len(n)
n=int(n)
ans=0
for i in range(2,7*l):
    t=int(n**(1/i))
    for j in range(3):
        if (t+j)**i<=n:
            ans=max(t**i,ans)
print(ans)
X = int(input())
ans = [1]
for i in range(2, X):
    v = i * i
    while v < X:
        ans.append(v)
        v *= i
print(max(ans))
import sys
X = int(input())
L = []
for i in range(1,32):
  for j in range(1,10):
    if X <= i**j:
      L.append(i**(j-1))
      break
print(max(L))
X = int(input())
a = 0
while a == 0:
    b = 0
    N, n = X, X
    for i in range(2, int(X ** 0.5) + 2):
        if b == 0:
            while N % i == 0:
                N //= i
                b = 1
        else:
            break
    if N == 1:
        ans = n
        a = 1
        print(ans)
    X -= 1
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      while m%j ==0:
        m //= j
      if m== 1 and j != i:
        print(i)
        exit()
print(ans)
x = int(input())
ans = 1
for i in range(x, 0, -1):
  m = i
  for j in range(2,int(m**0.5)+2):
    if m%j==0:
      while m%j ==0:
        m //= j
      if m== 1:
        print(i)
        exit()
print(ans)
X=int(input())
ans=1
for i in range(X):
  for n in range(X):
    if i**n<=X:
      ans=i**n
print(ans)
X = int(input())

ans = 0
for i in range(1, X+1):
    for j in range(2, X+1):
        if i**j > X:
            break
        else:
            ans = max(ans, i**j)

print(ans)
x=int(input())
for i in range(x):
  ima=x-i
  for j in range(ima+1):
    if j*j==ima:
      print(ima)
      exit()
X=int(input())
l=[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961]
for i in range(len(l)):
    if X>l[i]:
        print(l[i-1])
        exit()
def f(N):
  for i in range(N):
    for j in range(N):
    	if (e := pow(i, j)) <= N:
          yield e
n = int(input())
print(max(f(n)))
X = int(input())

maxi = 0

if X < 4:
    print(1)
    exit()

for i in range(1, X+1):
    for j in range(2, X+1):
        if i**j <= X and i**j >= maxi:
            maxi = i**j
        else:
            break

print(maxi)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(read())
print(int(x**0.5)**2)
x = int(input())
for i in range(1,x+1):
    for n in range(2,10):
        if i**n <= x:
            count = i**n
print(count)
X = int(input())
n = 0
while n**2 <= X:
    n+=1
print((n-1)**2)
x = int(input())
y = 0
for i in range(x):
    for j in range(2,x):
        if i**j <= x:
            y = max(y, i**j)
        else:
            break
print(y)
import math
x = int(input())

for i in reversed(range(x+1)):
    if int(round(math.sqrt(i))**2) == i:
        print(i)
        break
x = int(input())

def solve(num):
    result = True
    for i in range(2, num+1):
        c = 0
        while num%i==0:
            c += 1
            num //= i
        if c%2==0:
            continue
        else:
            result = False
            break
    return result

for i in range(x, 0, -1):
    if solve(i)==True:
        print(i)
        break
X = int(input())
count = 1
for i in range (1,50):
    if i ** 2 <= X:
        count = i ** 2
print(count)
X = int(input())
ans=0
for p in range(2,10):
    for b in range(1,32):
        if(b**p <= X):
            ans = X
print(ans)
import math
x=int(input())
l=[1]
for i in range(2,int(math.sqrt(x))+1):
  p=i
  while 1:
    p*=i
    if p<=x:
      l.append(p)
    else:
      break
print(l[-1])
import math 
X=int(input())
max_num=0
for i in range(2,11):
  tei=math.floor(X**(1/i))
  if max_num<=tei**i:
    max_num=tei**i
print(max_num)
import bisect,collections,copy,itertools,math,numpy,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
X = I()
print(int(X**0.5)**2)
x = int(input())
print((int(x ** 0.5)) ** 2)
from math import sqrt, log
x = int(input())
ans = 1
for i in range(2, int(sqrt(x)) + 1):
    n = int(pow(i, max(2, int(log(x, i)))))
    if n <= x:
        ans = max(ans, n)
print(ans)
X = int(input())
check =[]
check2=[]
for i in range(1,33):
    for s in range(2,11):
        check.append(pow(i,s))

#print(check)
for i in check:
    if i<=X:
        check2.append(i)
print(check2)
print(max(check2))
X = int(input())
print(int((X ** 0.5)) ** 2)
X = int(input())
for i in range(40):
    if i**2 > X:
        print((i-1)**2)
        break
a = int(input())
mx = 1

for i in range(2,a):
    j=2
    while i**j <a:
        print(i,j)
        mx = max(i**j,mx)
        j+=1

print(mx)
x = int(input())
ma = 0
for i in range(1,100):
    for j in range(1,100):
        if i**j <= x:
            ma = max(ma,i**j)
print(ma)
n = int(input())
p = int(n**0.5)**2
print(p)
X = int(input())

def han(n, k):
  if int(n**(1/k)) == n**(1/k):
    return True
  else:
    return False
  
while 1:
  if han(X, 2) or han(X, 3) or han(X, 5) or han(X, 7) or han(X, 4) or han(X, 6) or han(X, 8) or han(X, 9) or han(X, 10):
    print(X)
    break
  X -= 1
x = int(input())

i = 1
while x > i**2:
    i += 1

if x == i**1:
    print(i**2)
else:
    print((i-1)**2)
import sys
import math
x = int(input())
for i in range(int(math.sqrt(x))+1, 0, -1):
    if i * i <= x:
        print(i*i)
        sys.exit(0)
a=int(input())
d=0
for i in range(1000):
  b=i+2
  while b<a:
    b=b*(i+2)
  c=b/(i+2)
  if d<=c:
    d=c
print(int(d))
X = int(input())
val = 1
for b in range(1, int(X**0.5)+1):
    for p in range(2,X):
        if b**p > X:
            break
        else:
            val = b**p
print(val)
import math
x = int(input())

x_root = math.sqrt(x)
print(int(x_root)**2)
x = int(input())
l = [1]
for i in range(2,int(x**0.5)+1):
    num = i
    num *= num
    while num <= x:
        l.append(num)
        num *= num
print(max(l))
X = int(input())

num_list = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576,
            625, 676, 729, 784, 841, 900, 961, 1024]

i = 0
while num_list[i] <= X:
    i += 1

print(num_list[i - 1])
X=int(input())
a=0
while True:
    #print(a**2)
    if a**2>X:
        print((a-1)**2)
        exit()
    a+=1
N = 0
X = int(input())
while N**2 <= X:
  N += 1

print((N-1)**2)
x=int(input())

ans=1

for i in range(2,x):
  a=i
  while a*i<=x:
    a*=i
  if ans<a:
    ans=a

print(ans)
X = int(input())
ans = 0

for n in range(2,1000):
  ans = max(ans,int(X**(1/n))**n)
  
print(ans)
X = int(input())

ans = 0
for i in range(1,40):
    if X >= i*i:
        ans = i*i

print(ans)
X = int(input())
m = 1
while (m+1)**2 <= X:
    m += 1
print(m*m)
X = int(input())
l = []
if X < 4:
  print(1)
else:
  for i in range(2, int(X ** 0.5) + 1):
    j = 2
    while i ** j <= X:
      j += 1
    l.append(i ** j)
  l.sort()
  print(l[-1])
X = int(input())
ans = 0
for i in range(X):
    for j in range(2, X):
        if X >= i**j:
            ans = i**j
        else:
            break
print(ans)
x=int(input())

for i in range(x, 0, -1):
    for j in range(1, i+1):
        if i == j*j:
            print(i)
            exit()
X=int(input())
ans=0
for i in range(1000):
    if i*i<=X:ans=i
    else:break
print(ans**2)
N = int(input())
if N==1:
  print(1)
else:
  for i in reversed(range(1, N)):
    num = str(i**(0.5))
    check = num[num.index('.'):]
    if len(check)==2 and check==('.0'):
      print(i)
      break
a,b,c,x,y = map(int,input().split())

ans = a*x+b*y

for i in range(10**5+1):
  tmp = 2*c*i+max(0,x-i)*a+max(0,y-i)*b
  ans = min(ans,tmp)
  
print(ans)
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

A, B, C, X, Y = i_l()

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

ans=[]

ans.append(A*X+B*Y)
ans.append(C*max(X,Y)*2)

if X>Y:
  ans.append(C*min(X,Y)*2+A*(X-min(X,Y)))
if Y>X:  
  ans.append(C*min(X,Y)*2+B*(Y-min(X,Y)))

print(min(ans))
a, b, c, x, y = (int(x) for x in input().split())
ans = 10**18
ans = min(ans, a * x + b * y)
z = min(x, y)
ans = min(ans, 2 * c * z + a * (x - z) + b * (y - z))
ans = min(ans, 2 * c * max(x, y))
print(ans)
a, b, c, x, y = map(int, input().split())
minVal = c * 2 * (10 ** 5)
for i in range(10**5):
    total = (c*2) * i + a * max(0, x-i) + b * max(0, y-i)
    minVal = min(total, minVal)
print(minVal)
a,b,c,x,y=map(int,input().split())

aaa=[]

aaa.append(2*c*max([x,y]))
aaa.append(a*x+b*y)

if x > y:
    aaa.append(2*c*y+a*(x-y))
elif x < y:
    aaa.append(2*c*x+b*(y-x))

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

anslist=[]

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

if C*2 < A+B:
    if X < Y:
        print(min(C*2*X + (Y-X)*B, C*2*Y))
    else:
        print(min(C*2*Y + (X-Y)*A, C*2*X))
else:
    print(A*X+B*Y)
A,B,C,X,Y = map(int,input().split())
if X<Y:
    print(min(A*X+B*Y,Y*C*2,X*C*2+B*(Y-X)))
else:
    print(min(A*X+B*Y,X*C*2,Y*C*2+A*(X-Y)))
A, B, C, X, Y = 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
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

ans = 10 ** 10
for c in range(2 * 10 ** 5 + 1):
    a = X - c // 2
    b = Y - c // 2
    if a < 0:
        a = 0
    if b < 0:
        b = 0
    ans = min(ans, A * a + B * b + C * c)
print(ans)
A, B, C, X, Y = map(int, input().split())
C *= 2
if X == Y:
    print(min(C * X, A * X + B * Y))
if X > Y:
    print(min(C * X, C * Y + A * (X - Y), A * X + B * Y))
if X < Y:
    print(min(C * Y, C * X + B * (Y - X), A * X + B * Y))
import math
a, b, c, x, y = map(int, input().split())
n = a*x + b*y
m = c*2*max(x,y)
min_xy = min(x,y)
k = min_xy*2*c + (x-min_xy)*a + (y-min_xy)*b
print(min(n,m,k))
A,B,C,X,Y=map(int,input().split())

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


    
if __name__ == '__main__':
    main()
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)
a, b, c, x, y = [int(i) for i in input().split()]

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

cost1 = a * x + b * y
cost2 = c * max(x, y) * 2
if x < y:
    cost3 = c * x * 2 + b * (y - x)
else:
    cost3 = c * y * 2 + a * (x - y)
print(min(cost1, cost2, cost3))
A, B, C, x, y = list(map(int, input().split()))

cost = 1e+15
for i in range(max(x, y)+1):
  xx = max(0, x - i)
  yy = max(0, y - i)
  cost = min(cost, A * xx + B * yy + 2*C*i)
print(cost)
def main():
    a, b, c, x, y = map(int, input().split())

    total_min = a * x + b * y

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

if __name__ == "__main__":
    main()
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())

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())
if x < y:
  a, b, x, y = b, a, y, x # x >= y
m1 = y * 2 * c + (x - y) * a
m2 = a * x + b * y
m3 = x * c * 2
print(min(m1, m2, m3))
A, B, C, X, Y = map(int, input().split())

if (A+B) <= 2*C:
  print(A*X + B*Y)
else:
  Z = 2 * min(X, Y)
  X_rem = X - Z // 2
  Y_rem = Y - Z // 2
  
  if (X_rem != 0) and (A > 2*C):
    print(C*(2*X))
  elif (Y_rem != 0) and (B > 2*C):
    print(C*(2*Y))
  else:
    print(A*X_rem + B*Y_rem + C*Z)
A,B,C,X,Y = map(int,input().split())
C *= 2
ax = 0
bx = 0
num = 0
while ax < X or bx < Y:
  if ax < X and bx < Y:
    if A+B < C:
      num += A+B
    else:
      num += C
    ax += 1
    bx += 1
  elif ax < X:
    if A < C:
      num += A
    else:
      num += C
    ax += 1
  else:
    if B < C:
      num += B
    else:
      num += C
    bx += 1
print(num)
a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
for i in range(0, 2 * max(x, y) + 2, 2):
    pay = max(0, (x - i / 2)) * a + max(0, (y - i / 2)) * b + c * i
    ans = min(ans, pay)
print(int(ans))
a,b,c,x,y=map(int,input().split())
if a+b<=2*c: print(a*x+b*y)
else:
    ans=min(x,y)*2*c
    dif=abs(x-y)
    if x>y:
        if a>=2*c:
            ans+=2*dif*c
        else:
            ans+=a*dif
    else:
        if b>=2*c:
            ans+=2*dif*c
        else:
            ans+=b*dif
    print(ans)
a,b,c,x,y = map(int,input().split())
ans = 0
if x > y:
    a,b,x,y = b,a,y,x
if a + b >= 2 * c:
    ans1 = 2 * c * x + b * (y - x)
    ans2 = 2 * c * y
    print(min(ans1,ans2))
else:
    print(a*x + b*y)
a,b,c,x,y = map(int,input().split())

amax = x*a
bmax = y*b

ans = amax+bmax

for _ in range(max(x,y)):
    if x <= 0:
        ans = min(ans-b+2*c,ans)

    elif y <= 0:
        ans = min(ans-a+2*c,ans)

    else:
        ans = min(ans-a-b+2*c,ans)
        
    x-=1
    y-=1
 #   print(x,y,ans)

print(ans)