CodeEff/ECCO huggingface dataset:
# Original solution
def main():
    INF = 10 ** 12
    N = int(eval(input()))
    A = list(map(int, input().split(' ')))
    cumsum = [0 for _ in range(N)]
    cumsum[0] = A[0]
    for i in range(1, N):
        cumsum[i] = A[i] + cumsum[i - 1]
    dp = [[0 for _ in range(N)] for _ in range(N)]

    def solve(left, right):
        if left == right:
            return 0
        ret = dp[left][right]
        if ret > 0:
            return ret
        ret = INF
        for mid in range(left, right):
            ret = min([
                ret,
                solve(left, mid) + solve(mid + 1, right)
            ])
        ret += cumsum[right] - (cumsum[left - 1] if left > 0 else 0)
        dp[left][right] = ret
        return ret

    print((solve(0, N - 1)))


if __name__ == '__main__':
    main()

# Optimized solution
def main():
    INF = 10 ** 15
    N = int(eval(input()))
    A = list(map(int, input().split(' ')))
    cumsum = [0 for _ in range(N)]
    cumsum[0] = A[0]
    for i in range(1, N):
        cumsum[i] = A[i] + cumsum[i - 1]
    dp = [[0 for _ in range(N)] for _ in range(N)]

    def solve(left, right):
        if left == right:
            return 0
        ret = dp[left][right]
        if ret > 0:
            return ret
        ret = INF
        for mid in range(left, right):
            ret = min([
                ret,
                solve(left, mid) + solve(mid + 1, right)
            ])
        ret += cumsum[right] - (cumsum[left - 1] if left > 0 else 0)
        dp[left][right] = ret
        return ret

    print((solve(0, N - 1)))


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

cum = [[0]*(N) for i in range(N)]
for i in range(N):
  c = 0
  for j in range(i, N):
    c += A[j]
    cum[i][j] = c

dp = [[0]*N for i in range(N)]

for n in range(1, N+1):
  for i in range(N-n):
    j = i + n
    min_cost = 0
    for k in range(i, j):
      if min_cost == 0:
        min_cost = dp[i][k] + dp[k+1][j]
      else:
        min_cost = min(min_cost, dp[i][k]+dp[k+1][j])
    
    dp[i][j] = min_cost + cum[i][j]

print((dp[0][N-1]))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

"""
cum = [[0]*(N) for i in range(N)]
for i in range(N):
  c = 0
  for j in range(i, N):
    c += A[j]
    cum[i][j] = c
"""
cum = [0]
for a in A:
  cum.append(cum[-1] + a)


dp = [[0]*N for i in range(N)]

for n in range(1, N+1):
  for i in range(N-n):
    j = i + n
    min_cost = 0
    for k in range(i, j):
      if min_cost == 0:
        min_cost = dp[i][k] + dp[k+1][j]
      else:
        min_cost = min(min_cost, dp[i][k]+dp[k+1][j])
    
    dp[i][j] = min_cost + (cum[j+1]-cum[i])

print((dp[0][N-1]))
# Original solution
#!/usr/bin/env python3
import sys
from itertools import accumulate
import functools
INF = float("inf")


def solve(N: int, a: "List[int]"):

    dp = [[0]*N for _ in range(N)]
    acc = [0]+list(accumulate(a))

    @functools.lru_cache(maxsize=None)
    def rec(l, r):
        if l == r:
            return 0

        wa = acc[r+1]-acc[l]
        ans = INF
        for k in range(l, r):
            ans = min(rec(l, k) + rec(k+1, r), ans)
        return ans + wa

    print((rec(0, N-1)))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
from itertools import accumulate
import functools
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, a: "List[int]"):

    dp = [[-1]*N for _ in range(N)]
    acc = [0]+list(accumulate(a))

    def rec(l, r):
        if dp[l][r] > 0:
            return dp[l][r]
        if l == r:
            return 0

        wa = acc[r+1]-acc[l]
        ans = INF
        for k in range(l, r):
            ans = min(rec(l, k) + rec(k+1, r), ans)
        dp[l][r] = ans + wa
        return dp[l][r]

    print((rec(0, N-1)))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
a= list(map(int, input().split()))
a+=a
INF=10**12
dp=[[[INF,0] for i in range(2*n+1)] for i in range(2*n+1)]
# dp[i][j][0]: コスト
# dp[i][j][1]:合成したスライムの合計

for i in range(n):
    for l in range(2*n-i):
        r=l+i
        if r==l:
            dp[l][r][1]=a[l]
            dp[l][r][0]=0
        else:
            # 合成の仕方を確定
            for k in range(l,r):
                dp[l][r][0]=min(dp[l][k][1]+dp[k+1][r][1]+dp[l][k][0]+dp[k+1][r][0],dp[l][r][0])
            dp[l][r][1]=dp[l][r-1][1]+a[r]
print((dp[0][n-1][0]))

# Optimized solution
import sys
import itertools
input = sys.stdin.readline

n=int(eval(input()))
a= list(map(int, input().split()))
a+=a
b=itertools.accumulate(a)
b=[0]+list(b)
INF=10**15
dp=[[INF] *(2*n+1) for i in range(2*n+1)]
# dp[i][j][0]: コスト
# dp[i][j][1]:合成したスライムの合計

for i in range(n):
    for l in range(2*n-i):
        r=l+i
        if r==l:
            dp[l][r]=0
        else:
            # 合成の仕方を確定
            for k in range(l,r):
                dp[l][r]=min(dp[l][k]+dp[k+1][r]+b[r+1]-b[l],dp[l][r])

print((dp[0][n-1]))
# Original solution
inf = float('inf')

def accmulate(array):
    global cs
    cs = [0]*(len(array)+1)
    for i in range(len(array)):
        cs[i+1] = cs[i] + array[i]

def query(l,r):
    return cs[r+1] - cs[l]

N = int(eval(input()))
A = list(map(int,input().split()))

accmulate(A)

dp = [[inf]*(N+1) for _ in range(N+1)]

for i in range(N):
    dp[i][i+1] = 0

for i in range(N-1):
    dp[i][i+2] = A[i] + A[i+1]

for b in range(3,N+1):
    for i in range(N-b+1):
        j = i + b
        for k in range(i+1,j):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j] + query(i,j-1))

ans = dp[0][N]
print(ans)

# Optimized solution
inf = float('inf')

def accmulate(array):
    global cs
    cs = [0]*(len(array)+1)
    for i in range(len(array)):
        cs[i+1] = cs[i] + array[i]

def query(l,r):
    return cs[r+1] - cs[l]

N = int(eval(input()))
A = list(map(int,input().split()))

accmulate(A)

dp = [[inf]*(N+1) for _ in range(N+1)]

for i in range(N):
    dp[i][i+1] = 0

for b in range(2,N+1):
    for i in range(N-b+1):
        j = i + b
        for k in range(i+1,j):
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j] + query(i,j-1))

ans = dp[0][N]
print(ans)
# Original solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
# n = 4
# A = [10, 20, 30, 40]
inf = 10**20
DP = [[None for r in range(n+1)] for l in range(n)]
S = [0]
for i in range(n):
    S.append(S[-1]+A[i])


def f(l, r):
    if r <= l+1:
        DP[l][r] = 0
    if DP[l][r] != None:
        return DP[l][r]
    DP[l][r] = S[r]-S[l]+min([f(l, i)+f(i, r) for i in range(l+1, r)])
    return DP[l][r]


print((f(0, n)))


# Optimized solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
# n = 4
# A = [10, 20, 30, 40]
DP = [[None for r in range(n+1)] for l in range(n)]
S = [0]
for i in range(n):
    S.append(S[-1]+A[i])


def dp(l, r):
    # 区間[l,r)での最小コスト
    if r <= l+1:
        DP[l][r] = 0
    if DP[l][r] != None:
        return DP[l][r]
    # S[r]-S[l]=sum(A[l:r])
    DP[l][r] = S[r]-S[l]+min([dp(l, i)+dp(i, r) for i in range(l+1, r)])
    return DP[l][r]


print((dp(0, n)))
# Original solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
# n = 4
# A = [10, 20, 30, 40]
DP = [[None for r in range(n+1)] for l in range(n)]
S = [0]
for i in range(n):
    S.append(S[-1]+A[i])


def dp(l, r):
    # 区間[l,r)での最小コスト
    if r <= l+1:
        DP[l][r] = 0
    if DP[l][r] != None:
        return DP[l][r]
    # S[r]-S[l]=sum(A[l:r])
    DP[l][r] = S[r]-S[l]+min([dp(l, i)+dp(i, r) for i in range(l+1, r)])
    return DP[l][r]


print((dp(0, n)))


# Optimized solution
n = int(eval(input()))
*A, = list(map(int, input().split()))
S = [0]
for i in range(n):
    S.append(S[-1]+A[i])
DP = [[None for r in range(n+1)] for l in range(n)]
def dp(l, r):
    if r <= l+1:
        return 0
    if DP[l][r] != None:
        return DP[l][r]
    DP[l][r] = S[r]-S[l]+min([dp(l, i)+dp(i, r) for i in range(l+1, r)])
    return DP[l][r]
print((dp(0, n)))
# Original solution
def solve(n, k):
    MOD = 998244353

    if n > k:
        return 0

    invs = [1] * (k + 1)
    pf, kf = 1, 1
    for m in range(2, k + 1):
        pf = kf
        kf *= m
        kf %= MOD
        invs[m] = pow(kf, MOD - 2, MOD)

    ans = 0
    if k & 1 == 0:
        if n == 1:
            ans = 1
        else:
            r = k >> 1
            t = r - n + 1
            ans = pf * (invs[r] * invs[r - 1] - invs[r + t] * invs[k - r - t - 1]) % MOD

    for r in range(k // 2 + 1, k + 1):
        if r * 2 >= n + k:
            ans += kf * invs[r] * invs[k - r]
        else:
            t = r - n + 1
            ans += kf * (invs[r] * invs[k - r] - invs[r + t] * invs[k - r - t])
        ans %= MOD
    return ans


print((solve(*list(map(int, input().split())))))


# Optimized solution
def solve(n, k):
    MOD = 998244353

    if n > k:
        return 0
    if n == 1:
        return pow(2, k - 1, MOD)

    invs = [1] * (k + 1)
    pf, kf = 1, 1
    for m in range(2, k + 1):
        pf = kf
        kf *= m
        kf %= MOD
        invs[m] = pow(kf, MOD - 2, MOD)

    ans = 0
    if k & 1 == 0:
        r = k >> 1
        s = k - n + 1
        ans = pf * (invs[r] * invs[r - 1] - invs[s] * invs[k - s - 1]) % MOD

    for r in range(k // 2 + 1, k + 1):
        if r * 2 >= n + k:
            ans += kf * invs[r] * invs[k - r]
        else:
            s = r * 2 - n + 1
            ans += kf * (invs[r] * invs[k - r] - invs[s] * invs[k - s])
        ans %= MOD
    return ans


print((solve(*list(map(int, input().split())))))
# Original solution
def solve(n, k):
    MOD = 998244353

    if n > k:
        return 0
    if n == 1:
        return pow(2, k - 1, MOD)

    invs = [1] * (k + 1)
    pf, kf = 1, 1
    for m in range(2, k + 1):
        pf = kf
        kf *= m
        kf %= MOD
        invs[m] = pow(kf, MOD - 2, MOD)

    ans = 0
    if k & 1 == 0:
        r = k >> 1
        s = k - n + 1
        ans = pf * (invs[r] * invs[r - 1] - invs[s] * invs[k - s - 1]) % MOD

    for r in range(k // 2 + 1, k + 1):
        if r * 2 >= n + k:
            ans += kf * invs[r] * invs[k - r]
        else:
            s = r * 2 - n + 1
            ans += kf * (invs[r] * invs[k - r] - invs[s] * invs[k - s])
        ans %= MOD
    return ans


print((solve(*list(map(int, input().split())))))


# Optimized solution
def solve(n, k):
    MOD = 998244353

    if n > k:
        return 0
    if n == 1:
        return pow(2, k - 1, MOD)

    pf, kf = 1, 1
    for m in range(2, k + 1):
        pf = kf
        kf *= m
        kf %= MOD
    inv = pow(kf, MOD - 2, MOD)
    invs = [1] * (k + 1)
    invs[k] = inv
    for m in range(k, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv

    ans = 0
    if k & 1 == 0:
        r = k >> 1
        s = k - n + 1
        ans = pf * (invs[r] * invs[r - 1] - invs[s] * invs[k - s - 1]) % MOD

    for r in range(k // 2 + 1, k + 1):
        if r * 2 >= n + k:
            ans += kf * invs[r] * invs[k - r]
        else:
            s = r * 2 - n + 1
            ans += kf * (invs[r] * invs[k - r] - invs[s] * invs[k - s])
        ans %= MOD

    return ans


print((solve(*list(map(int, input().split())))))
# Original solution
n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
a=1<<~-k
for i in r(min(n-1,k)):a-=f[k-1]*pow((f[i]*f[k-1-i])%p,-1,p)
print((a%p))

# Optimized solution
n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
a=0
for i in r(n-1,k):a+=f[k-1]*pow(f[i]*f[k-1-i],-1,p)
print((a%p))
# Original solution
n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
a=0
for i in r(n-1,k):a+=f[k-1]*pow(f[i]*f[k-1-i],-1,p)
print((a%p))

# Optimized solution
n,k=list(map(int,input().split()))
p=998244353
r=range
f=[1]
for i in r(k):f+=[-~i*f[i]%p]
print((sum(f[k-1]*pow(f[i]*f[k-1-i],-1,p)for i in r(n-1,k))%p))
# Original solution
def combs_mod(n,k,mod):
  #nC0からnCkまで
  inv = [1]*(k+1)
  for i in range(1,k+1):
    inv[i] = pow(i,mod-2,mod)
  ans = [1]*(k+1)
  for i in range(1,k+1):
    ans[i] = ans[i-1]*(n+1-i)*inv[i]%mod
  return ans
def solve():
  mod = 998244353
  N, K = list(map(int, input().split()))
  ans = 0
  if K<N:
    return ans
  com = combs_mod(K,K,mod)
  com2 = combs_mod(K-1,K-1,mod)
  for r in range(K+1):
    b = K-r
    dif = r-b
    if dif<0 or r<N:
      continue
    elif dif==0:
      ans += com2[r]
      if N>=2:
        ans -= com2[N-2]
    elif dif<N:
      ans += com[r] - com[N-1-dif]
    else:
      ans += com[r]
    ans %= mod
  return ans
print((solve()))

# Optimized solution
def combs_mod(n,k,mod):
  #nC0からnCkまで
  inv = [1]*(k+1)
  for i in range(1,k+1):
    inv[i] = pow(i,-1,mod)
  ans = [1]*(k+1)
  for i in range(1,k+1):
    ans[i] = ans[i-1]*(n+1-i)*inv[i]%mod
  return ans
def solve():
  mod = 998244353
  N, K = list(map(int, input().split()))
  ans = 0
  if K<N:
    return ans
  com = combs_mod(K,K,mod)
  com2 = combs_mod(K-1,K-1,mod)
  for r in range(K+1):
    b = K-r
    dif = r-b
    if dif<0 or r<N:
      continue
    elif dif==0:
      ans += com2[r]
      if N>=2:
        ans -= com2[N-2]
    elif dif<N:
      ans += com[r] - com[N-1-dif]
    else:
      ans += com[r]
    ans %= mod
  return ans
print((solve()))
# Original solution
m=998244353
def c(n,r):return (g[n]*h[r]*h[n-r])%m
g=[1,1]
h=g[:]
v=[0,1]
for i in range(2,999999):
  g.append((g[-1]*i)%m)
  v.append((-v[m%i]*(m//i))%m)
  h.append((h[-1]*v[i])%m)
N,K=list(map(int,input().split()))
P=0
for k in range(N-1,K):P+=c(K-1,k)
print((P%m))

# Optimized solution
m=998244353
def c(n,r):return (g[n]*h[r]*h[n-r])%m
g=[1,1]
h=g[:]
v=[0,1]
for i in range(2,999999):
  g.append(g[-1]*i%m)
  v.append(m//i*-v[m%i]%m)
  h.append(h[-1]*v[i]%m)
N,K=list(map(int,input().split()))
P=0
for k in range(N-1,K):P+=c(K-1,k)
print((P%m))
# Original solution
import sys

def solve():
    a = int(eval(input()))
    b = int(eval(input()))

    if a == b:
        print((1))
        return

    t = a ^ b
    N = len(bin(t)) - 2
    t = 1 << N

    a = a & (t - 1)
    b = b & (t - 1)

    blen = len(bin(b)) - 2

    sb = b & (2**(blen - 1) - 1)

    if sb == 0:
        sblen = 0
    else:
        sblen = len(bin(sb)) - 2

    s = (1<<sblen) - 1

    ymax = b | s

    T = 1<<(N - 1)

    ans = T - a

    if ymax < T + a:
        ans += ymax - T + 1 + T - a
    else:
        ans += T

    print(ans)


if __name__ == '__main__':
    solve()

# Optimized solution
import sys

def solve():
    a = int(eval(input()))
    b = int(eval(input()))

    if a == b:
        print((1))
        return

    t = a ^ b
    N = bitlen(t)

    a = a & (2**N - 1)
    b = b & (2**N - 1)

    blen = bitlen(b)

    sb = b & (2**(blen - 1) - 1)

    sblen = bitlen(sb)

    s = 2**sblen - 1

    ymax = b | s

    T = 2**(N - 1)

    ans = T - a

    if ymax < T + a:
        ans += ymax + 1 - a
    else:
        ans += T

    print(ans)

def bitlen(x):
    return 1 + bitlen(x >> 1) if x else 0

if __name__ == '__main__':
    solve()
# Original solution
N, A, B =(int(x) for x in input().split())
print((min(A*N, B)))

# Optimized solution
N, A, B = list(map(int, input().split()))
print((min(A*N, B)))
# Original solution
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in list(inspect.currentframe().f_back.f_locals.items())}
    print((', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args)))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# Set 2 dimension list
def dim2input(N):
    li = []
    for _ in range(N):
        li.append(list(map(int, eval(input()))))
    return li

# --------------------------------------------

dp = None

def main():
    N, A, B = list(map(int, input().split()))

    print((min(N*A, B)))

main()


# Optimized solution
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in list(inspect.currentframe().f_back.f_locals.items())
    }
    print((', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args)))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


def main():
    N, A, B = li_input()

    print((min(N * A, B)))


main()
# Original solution
a=input().split()
N=int(a[0])
A=int(a[1])
B=int(a[2])
if(N*A<=B):
  print((N*A))
else:
  print(B)

# Optimized solution
T,A,B = list(map(int,input().split()))

if(A*T<B):
  print((A*T))
else:
  print(B)
# Original solution
N,A,B = list(map(int,input().split()))
print((min(N*A, B)))


# Optimized solution
N,A,B = list(map(int,input().split()))
print((min(B,N*A)))
# Original solution
a, b, c = list(map(int, input().split()))
if a * b <= c:
  print((a * b))
else:
  print(c)


# Optimized solution
a, b, c = list(map(int, input().split()))
print((min(a * b, c)))
# Original solution
N, A, B = list(map(int,input().split()))
a = A * N
if(a > B):
  print(B)
else:
  print(a)

# Optimized solution
N, A, B = list(map(int,input().split()))
print((min(N*A, B)))
# Original solution
i=list(map(int,input().split()))
a=i[0]
b=i[1]
def max(x,y,z):
  if x>y:
    m=x
  else:
    m=y
  if z>m:
    m=z
  return m
ans=max(a+b,a-b,a*b)
print(ans)

# Optimized solution
a, b = list(map(int, input().split()))
print((max(a+b, a-b, a*b)))
#こぴぺ
# Original solution
a,b = list(map(int, input().split()))
print((max(a+b, a-b, a*b)))

# Optimized solution
a,b=list(map(int,input().split()))
print((max(a+b,max(a-b,a*b))))
# Original solution
temp=list(map(int, input().split()))

print((max([temp[0]+temp[1], temp[0]-temp[1], temp[0]*temp[1]])))

# Optimized solution
A, B= list(map(int, input().split()))
c= A+B
d= A-B
e= A*B
f=max(c, d, e)
print(f)
# Original solution
a = list(map(int,input().split()))

x = a[0] + a[1]
y = a[0] - a[1]
z = a[0] * a[1]

if x >= y and x >= z:
  print(x)
elif y >= x and y >= z:
  print(y)
else:
  print(z)




# Optimized solution
a = list(map(int,input().split()))

x = a[0] + a[1]
y = a[0] - a[1]
z = a[0] * a[1]

print((max([x,y,z])))
# Original solution
import time

time.sleep(3)
a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))

# Optimized solution
import time
 
time.sleep(0.5)
a, b = list(map(int, input().split()))
print((max(a + b, a - b, a * b)))
# Original solution
a,b= list(map(int,input().split()))
print((max((a+b,a-b,a*b))))


# Optimized solution
a,b= list(map(int,input().split()))
print((max(a+b,a-b,a*b)))
# Original solution
# coding: utf-8
# Your code here!
A,B = list(map(int,input().split()))
C = A+B
D = A-B
E = A*B
print((max([C,D,E])))


# Optimized solution
A,B = list(map(int, input().split()))
print((max(A*B,A-B,A+B)))
# Original solution
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(eval(input())) for _ in range(n)]

a,b = get_nums_l()
print((max(a+b, a-b, a*b)))

# Optimized solution

import sys

def log(*args, **kwargs):
    print(*args, file=sys.stderr)

log("hogehoge")

a,b = map(int, input().split())

print(max(a*b, a+b, a-b))
# Original solution

a, b = list(map(int, input().split()))
x = a+b
y = a-b
v = a*b
print((max(x,y,v)))

# Optimized solution

a, b = list(map(int, input().split()))
x = a+b
y = a-b
z = a*b
print((max(x,y,z)))
# Original solution
a,b=list(map(int, input().split()))

print((max(a+b,a-b,a*b)))

# Optimized solution
A,B=list(map(int,input().split()))
C=A+B
D=A-B
E=A*B
ans=max(C,D,E)
print(ans)
# Original solution
A, B = list(map(int, input().split()))

ans = max(A + B, A - B, A * B)

print(ans)


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

x = A+B
y =A-B
z =A*B

if x > y:
  if x>z:
    ans = x
  else:
    ans = z
else:
  if y>z:
    ans = y
  else:
    ans = z

print(ans)
# Original solution
A, B = list(map(int, input().split()))
if B > 0:
    if A * B > (A + B):
        val = A * B
    else:
        val = A + B
else:
    if A * B > (A - B):
        val = A * B
    else:
        val = A - B
        
print(("%d"%val))


# Optimized solution
A, B = list(map(int, input().split()))
print(("%d"% max([A + B, A - B, A* B])))
# Original solution
i = list(map(int, input().split()))
l = [i[0] + i[1], i[0] - i[1], i[0]*i[1]]
print((max(l, key=int)))

# Optimized solution
i = list(map(int, input().split()))

a = i[0]+i[1]
b = i[0]*i[1]
c = i[0]-i[1]

print((max(a,b,c)))
# Original solution
a, b = list(map(int, input().split()))

print((max(a+b, a-b, a*b)))

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

print((max([a+b, a-b, a*b])))
# Original solution
# A - +-x
def main():
    a, b = list(map(int, input().split()))
    print((max([a+b, a-b, a*b])))

if __name__ == '__main__':
    main()

# Optimized solution
# A - +-x
def main():
    a, b = list(map(int, input().split()))
    print((max(a+b, a-b, a*b)))

if __name__ == '__main__':
    main()
# Original solution
A,B=list(map(int,input().split()))
print((max(A*B,A+B,A-B)))

# Optimized solution
A,B = list(map(int,input().split()))
print((max(A+B,A-B,A*B)))
# Original solution
a, b = list(map(int, input().split()))
print((max(a-b, a+b, a*b)))

# Optimized solution
n, m = list(map(int, input().split()))
print((max(n+m, n-m, n*m)))
# Original solution
a,b = list(map(int,input().split()))
c = max(a+b, a-b, a*b)
print(c)

# Optimized solution
def resolve():
    a, b = list(map(int, input().split()))
    print((max(a+b, a-b, a*b)))
resolve()
# Original solution
a,b = list(map(int, input().split()))
li = [a+b, a-b,a*b]
print((max(li)))


# Optimized solution
a,b=list(map(int,input().split()))
print((max(a+b,a-b,a*b)))
# Original solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(eval(input()))
def getList():
    return list(map(int, input().split()))
import math

a, b = getList()

print((max([a+b, a-b, a*b])))

# print(ans)

# Optimized solution
import sys
# from collections import defaultdict, deque
# import math
# import copy
# from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    a,b = getList()
    print((max([a+b, a - b, a * b])))
    return
def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()
# Original solution

A,B = list(map(int,input().split()))

print((max(A+B,A-B,A*B)))


# Optimized solution
a , b = input().split()
a =int(a)
b =int(b)
print((max(a + b,a - b,a * b)))
# Original solution
a,b = list(map(int,input().split()))
print((max(a+b,a-b,a*b)))

# Optimized solution
a,b = list(map(int,input().split()))
ans1 = a+b
ans2 = a-b
ans3 = a*b
ans = max(ans1,ans2,ans3)
print(ans)