Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:  1+2*3=7  1*(2+3)=5  1*2*3=6  (1+2)*3=9 

Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.

It's easy to see that the maximum value that you can obtain is 9.

Your task is: given a, b and c print the maximum value that you can get.


-----Input-----

The input contains three integers a, b and c, each on a single line (1 ≤ a, b, c ≤ 10).


-----Output-----

Print the maximum value of the expression that you can obtain.


-----Examples-----
Input
1
2
3

Output
9

Input
2
10
3

Output
60

Difficulty: EASY

Solutions:
(a, b, c) = [int(input()) for i in 'abc']
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


(a, b, c) = (int(input()), int(input()), int(input()))
print(max(a * b * c, (a + b) * c, a * (b + c), a + b + c))


a = int(input())
b = int(input())
c = int(input())
exp1 = a + b + c
exp2 = a * b * c
exp3 = a + b * c
exp4 = a * b + c
exp5 = a * (b + c)
exp6 = (a + b) * c
print(max(exp1, exp2, exp3, exp4, exp5, exp6))


a = int(input())
b = int(input())
c = int(input())
v = []
v.append(a * b * c)
v.append((a + b) * c)
v.append(a * (b + c))
v.append(a + b * c)
v.append(a * b + c)
v.append(a + b + c)
print(max(v))


a = int(input())
b = int(input())
c = int(input())
d = a * b * c
e = a * (b + c)
f = (a + b) * c
g = a + b + c
h = a + b * c
i = a * b + c
print(max(d, max(e, max(f, max(g, max(h, i))))))


a = int(input())
b = int(input())
c = int(input())
s1 = a + b + c
s2 = a * b + c
s3 = a + b * c
s4 = (a + b) * c
s5 = a * (b + c)
s6 = a * b * c
print(max(s1, s2, s3, s4, s5, s6))


a = int(input())
b = int(input())
c = int(input())
var1 = a * b * c
var2 = (a + b) * c
var3 = a * (b + c)
var4 = a + b + c
print(max(var1, var2, var3, var4))


a = int(input())
b = int(input())
c = int(input())
ans = a * b * c
if (a + b) * c > ans:
	ans = (a + b) * c
if a * (b + c) > ans:
	ans = a * (b + c)
if a + b * c > ans:
	ans = a + b * c
if a * b + c > ans:
	ans = a * b + c
if a + b + c > ans:
	ans = a + b + c
print(ans)


a = int(input())
b = int(input())
c = int(input())
A = a + b + c
B = (a + b) * c
C = a * (b + c)
D = a * b + c
E = a * b * c
F = a + b * c
print(max(A, B, C, D, E, F))


a = int(input())
b = int(input())
c = int(input())
opt = []
opt.append(a + b + c)
opt.append(a * b * c)
opt.append((a + b) * c)
opt.append(a * (b + c))
opt.append(a * b + c)
opt.append(a + b * c)
print(max(opt))


a = int(input())
b = int(input())
c = int(input())
a1 = a * (b + c)
a2 = a * b * c
a3 = (a + b) * c
a4 = a + b + c
print(max(a1, a2, a3, a4))


a = int(input())
b = int(input())
c = int(input())
m = [0] * 5
m[0] = (a + b) * c
m[1] = a * (b + c)
m[2] = a * b * c
m[3] = a + b * c
m[4] = a + b + c
print(max(m))


a = int(input())
b = int(input())
c = int(input())
max = 0
if a + b + c > max:
	max = a + b + c
if a * b * c > max:
	max = a * b * c
if (a + b) * c > max:
	max = (a + b) * c
if a * (b + c) > max:
	max = a * (b + c)
if a + b * c > max:
	max = a + b * c
if a * b + c > max:
	max = a * b + c
print(max)


L = []
for i in range(3):
	x = int(input())
	L.append(x)
print(max(L[0] + (L[1] + L[2]), L[0] * (L[1] + L[2]), L[0] * L[1] * L[2], (L[0] + L[1]) * L[2]))


a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a * (b + c))
l.append(a + b * c)
l.append(a * b * c)
l.append((a + b) * c)
l.append(a + b + c)
print(max(l))


def max_arith(a, b, c):
	arr = [a * b * c, a * b + c, a + b * c, (a + b) * c, a * (b + c), a + b + c]
	return max(arr)
a = int(input())
b = int(input())
c = int(input())
print(max_arith(a, b, c))


a = int(input())
b = int(input())
c = int(input())
arr = []
arr.extend([a + b + c, a + b * c, (a + b) * c, a * b * c, a * b + c, a * (b + c)])
print(max(arr))


import sys
import math
x = int(input())
y = int(input())
z = int(input())
a = []
(a.append(x), a.append(y), a.append(z))
print(max(a[0] * a[1] * a[2], (a[0] + a[1]) * a[2], a[0] * (a[1] + a[2]), a[0] + a[1] + a[2]))


A = int(input())
B = int(input())
C = int(input())
op = []
op.append(A + B + C)
op.append(A * B * C)
op.append((A + B) * C)
op.append(A * B + C)
op.append(A + B * C)
op.append(A * (B + C))
print(max(op))


a = int(input())
b = int(input())
c = int(input())
li = []
li.append((a + b) * c)
li.append(a * (b + c))
li.append(a + b + c)
li.append(a * b * c)
li.sort(reverse=True)
print(li[0])


(a, b, c) = (0, 0, 0)
a = int(input())
b = int(input())
c = int(input())
w = a + b * c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
v = a + b + c
m = [w, x, y, z, v]
print(max(m))


a = int(input())
b = int(input())
c = int(input())
maior = 0
atual = a * b * c
if atual > maior:
	maior = atual
atual = (a + b) * c
if atual > maior:
	maior = atual
atual = a * (b + c)
if atual > maior:
	maior = atual
atual = a + b + c
if atual > maior:
	maior = atual
print(maior)


from sys import stdin
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
l1 = []
l1.append(a + b * c)
l1.append(a * (b + c))
l1.append(a * b * c)
l1.append((a + b) * c)
l1.append(a + b + c)
print(max(l1))


def get_int():
	return int(input())
(a, b, c) = (get_int(), get_int(), get_int())
ans1 = a * b * c
ans2 = a + b + c
ans3 = (a + b) * c
ans4 = a * b + c
ans5 = a * (b + c)
ans6 = a + b * c
print(max(ans1, ans6, ans5, ans4, ans3, ans2))


a = int(input())
b = int(input())
c = int(input())
w = []
w.append(a + b * c)
w.append(a * (b + c))
w.append(a * b * c)
w.append((a + b) * c)
w.append(a + b + c)
print(max(w))


a = int(input())
b = int(input())
c = int(input())
d = int()
if a > 1 and b > 1 and (c > 1):
	d = a * b * c
elif a == 1 and b > 1 and (c > 1):
	d = (a + b) * c
elif b == 1 and a > 1 and (c > 1):
	if (a + b) * c > (b + c) * a:
		d = (a + b) * c
	else:
		d = (b + c) * a
elif c == 1 and b > 1 and (a > 1):
	d = a * (b + c)
elif a == 1 and b == 1 and (c > 1):
	d = (a + b) * c
elif a == 1 and c == 1 and (b > 1):
	d = a + b + c
elif c == 1 and b == 1 and (a > 1):
	d = a * (b + c)
elif a == 1 and b == 1 and (c == 1):
	d = a + b + c
print(d)


a = int(input())
b = int(input())
c = int(input())
l = []
q = a + b + c
l.append(q)
w = a * b * c
l.append(w)
e = a * b + c
l.append(e)
r = (a + b) * c
l.append(r)
t = a * (b + c)
l.append(t)
print(max(l))


x = int(input())
y = int(input())
z = int(input())
print(max(x + y + z, x * y * z, x * (y + z), (x + y) * z))


a = int(input())
b = int(input())
c = int(input())

def maxx(a, b, c):
	return max(a + b + c, a + b * c, a * b + c, (a + b) * c, a * b * c, a * (b + c))
print(maxx(a, b, c))


a = int(input())
b = int(input())
c = int(input())
max1 = 0
g = a + b + c
d = a * (b + c)
e = (a + b) * c
f = a * b * c
print(max(d, e, f, g))


n = int(input())
a = int(input())
x = int(input())
q = n + a + x
w = n * a * x
e = n + a * x
r = n * a + x
t = n * (a + x)
y = (n + a) * x
print(max(q, w, e, r, t, y))


a = int(input())
b = int(input())
c = int(input())
m = 0
if a + b + c > m:
	m = a + b + c
if a * b * c > m:
	m = a * b * c
if (a + b) * c > m:
	m = (a + b) * c
if a * (b + c) > m:
	m = a * (b + c)
if a * b + c > m:
	m = (a + b) * c
if a + b * c > m:
	m = a * (b + c)
print(m)


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = a * (b + c)
f = a * b * c
g = (a + b) * c
h = a + b + c
if d >= e and d >= f and (d >= g) and (d >= h):
	print(d)
elif e >= d and e >= f and (e >= g) and (e >= h):
	print(e)
elif f >= e and f >= d and (f >= g) and (f >= h):
	print(f)
elif g >= f and g >= e and (g >= d) and (g >= h):
	print(g)
else:
	print(h)


a = int(input())
b = int(input())
c = int(input())
ans = a + b + c
new = a + b * c
new1 = (a + b) * c
if new > ans:
	ans = new
if new1 > ans:
	ans = new1
new = a * b + c
new1 = a * (b + c)
if new > ans:
	ans = new
if new1 > ans:
	ans = new1
new = a * b * c
if new > ans:
	ans = new
print(ans)


import operator
a = int(input())
b = int(input())
c = int(input())
ops = [operator.add, operator.mul]
res = 0
for ox in ops:
	for oy in ops:
		tmp = max(oy(ox(a, b), c), oy(a, ox(b, c)))
		if tmp > res:
			res = tmp
print(res)


x = int(input())
y = int(input())
z = int(input())
l = []
l.append(x + y + z)
l.append((x + y) * z)
l.append(x * (y + z))
l.append(x * y * z)
l.append(x * y + z)
l.append(x + y * z)
print(max(l))


a = int(input())
b = int(input())
c = int(input())
r1 = a + b + c
r2 = a * b * c
r3 = (a + b) * c
r4 = a * (b + c)
print(max(r1, r2, r3, r4))


a = int(input())
b = int(input())
c = int(input())

def calc1(a, b, c):
	return a + b * c

def calc2(a, b, c):
	return a * (b + c)

def calc3(a, b, c):
	return a * b * c

def calc4(a, b, c):
	return (a + b) * c

def calc5(a, b, c):
	return a + b + c
list = [calc1(a, b, c), calc2(a, b, c), calc3(a, b, c), calc4(a, b, c), calc5(a, b, c)]
print(max(list))


a = int(input())
b = int(input())
c = int(input())
lst = []
lst.append(a + b + c)
lst.append((a + b) * c)
lst.append(a * (b + c))
lst.append(a * b * c)
lst.append(a * b + c)
lst.append(a + b * c)
print(max(lst))


(x, y, z) = (int(input()), int(input()), int(input()))
li = []
li.insert(0, x + y * z)
li.insert(1, x * (y + z))
li.insert(2, x * y * z)
li.insert(3, (x + y) * z)
li.insert(4, x + y + z)
print(max(li))


(n, k, w) = [int(input()) for i in range(3)]
a = n + k * w
b = n * (k + w)
c = n * k * w
d = (n + k) * w
e = n + k + w
print(max(a, b, c, d, e))


a = int(input())
b = int(input())
c = int(input())
ans = 0
if a == 1:
	ans = a + b
	if c == 1:
		ans += 1
	else:
		ans *= c
elif b == 1:
	ans = b + min(a, c)
	other = max(a, c)
	if other == 1:
		ans += other
	else:
		ans *= other
elif c == 1:
	ans = b + c
	if a == 1:
		ans += a
	else:
		ans *= a
else:
	ans = a * b * c
print(ans)


import sys
a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	print(3)
	exit()
if a == 1 and c == 1:
	print(a + b + c)
	exit()
if a == 1 or b == 1 or c == 1:
	ans = max((a + b) * c, a * (b + c))
else:
	ans = a * b * c
print(ans)


t = input()
a = int(t)
t = input()
b = int(t)
t = input()
c = int(t)
case1 = a * b * c
case2 = a + b + c
case3 = a * b + c
case4 = (a + b) * c
case5 = a * (b + c)
case6 = a + b * c
caseList = []
caseList.extend((case1, case2, case3, case4, case5, case6))
maximum = max(caseList)
print(maximum)


try:
	a = int(input())
	b = int(input())
	c = int(input())
	l = list()
	s1 = a + b * c
	l.append(s1)
	s2 = a * (b + c)
	l.append(s2)
	s3 = a * b * c
	l.append(s3)
	s4 = (a + b) * c
	l.append(s4)
	s5 = a * b + c
	l.append(s5)
	s6 = a + b + c
	l.append(s6)
	print(max(l))
except:
	pass


x = int(input())
y = int(input())
z = int(input())
res = []
ma = 0
n = x + y * z
l = x * (y + z)
s = x * y * z
p = (x + y) * z
d = x + y + z
res.append(n)
res.append(l)
res.append(s)
res.append(p)
res.append(d)
print(max(res))


x = int(input())
y = int(input())
z = int(input())
if x != 1 and y != 1 and (z != 1):
	print(x * y * z)
else:
	print(max((x + y) * z, x * (y + z), x + y + z))


a = int(input())
b = int(input())
c = int(input())
A = []
A.append(a * b * c)
A.append(a + b + c)
A.append((a + b) * c)
A.append(a * (b + c))
print(max(A))


a = int(input())
b = int(input())
c = int(input())
q = a + b + c
w = (a + b) * c
e = a * (b + c)
r = a * b * c
print(max(q, w, e, r))


z = int(input())
x = int(input())
c = int(input())
o = []
for i in range(1):
	o.append((z + x) * c)
	o.append(z + x * c)
	o.append(z * x + c)
	o.append(z * (x + c))
	o.append(z * x * c)
	o.append(z + x + c)
o.sort()
print(o[-1])


a = int(input())
b = int(input())
c = int(input())
r1 = a + b * c
r2 = a * (b + c)
r3 = a * b * c
r4 = (a + b) * c
r5 = a + b + c
m = max(r1, r2, r3, r4, r5)
print(m)


a = []
for i in range(3):
	a.append(int(input()))
m = 0
m = a[0] * a[1] * a[2] if a[0] * a[1] * a[2] > m else m
m = (a[0] + a[1]) * a[2] if (a[0] + a[1]) * a[2] > m else m
m = a[0] * (a[1] + a[2]) if a[0] * (a[1] + a[2]) > m else m
m = a[0] + a[1] + a[2] if a[0] + a[1] + a[2] > m else m
print(m)


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def lis():
	return list(map(int, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
a = int(inp())
b = int(input())
c = int(input())
print(max(a * b * c, a + b + c, (a + b) * c, a * (b + c)))


def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	op = -898947568659
	op = max(a + b + c, op)
	op = max(a * b * c, op)
	op = max((a + b) * c, op)
	op = max(a * b + c, op)
	op = max(a + b * c, op)
	op = max(a * (b + c), op)
	return op
print(solve())


a = [int(input()), int(input()), int(input())]
answer = 0
x = 0
if a[0] == 1 and a[2] == 1:
	answer = a[0] + a[1] + a[2]
elif 1 not in a:
	answer = a[0] * a[1] * a[2]
elif (a[0] + a[1]) * a[2] > a[0] * (a[1] + a[2]):
	answer = (a[0] + a[1]) * a[2]
else:
	answer = a[0] * (a[1] + a[2])
print(answer)


a = int(input())
b = int(input())
c = int(input())
d = a * b * c
e = (a + b) * c
f = a * (b + c)
g = a + b + c
print(max(d, e, f, g))


a = int(input())
b = int(input())
c = int(input())
m = list()
m.append(a * b * c)
m.append(a + b + c)
m.append(a * b + c)
m.append(a * (b + c))
m.append((a + b) * c)
m.append(a + b * c)
print(max(m))


a = int(input())
b = int(input())
c = int(input())
p = (a + b) * c
q = a * (b + c)
r = a + b * c
s = a * b * c
t = a + b + c
print(max(p, q, r, s, t))


a = int(input())
b = int(input())
c = int(input())
if min(a, b, c) > 1:
	print(a * b * c)
else:
	print(max((a + b) * c, a * (b + c), a + b + c))


a = int(input())
b = int(input())
c = int(input())
arr = []
arr.append(a + b + c)
arr.append(a * b * c)
arr.append((a + b) * c)
arr.append(a + b * c)
arr.append(a * b + c)
arr.append(a * (b + c))
arr = sorted(arr)
print(arr[5])


x = int(input())
y = int(input())
z = int(input())

def calc(x, y, z):
	maxx = max(x + y + z, x + y * z, x * (y + z), x * y * z, (x + y) * z)
	return maxx
print(calc(x, y, z))


num = []
for i in range(3):
	num.append(int(input()))
print(max(num[0] * num[1] * num[2], num[0] * (num[1] + num[2]), (num[0] + num[1]) * num[2], num[0] + num[1] + num[2]))


a = int(input())
b = int(input())
c = int(input())
z = a + b + c
x = a + b * c
v = (a + b) * c
n = a * b + c
m = a * (b + c)
s = a * b * c
o = max(z, x, v, n, m, s)
print(o)


import math
a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
k = (a + b) * c
l = a + b + c
ans = max(max(max(max(x, y), z), k), l)
print(ans)


from sys import stdin, stdout
a = int(input())
b = int(input())
c = int(input())
arr = []
arr.append((a + b) * c)
arr.append(a * (b + c))
arr.append(a + b * c)
arr.append(a * b + c)
arr.append(a * b * c)
arr.append(a + b + c)
print(max(arr))


a = int(input())
b = int(input())
c = int(input())
a1 = a * b + c
a2 = a + b * c
a3 = a * b * c
a4 = a + b + c
a5 = a * (b + c)
a6 = (a + b) * c
print(max(a1, a2, a3, a4, a5, a6))


arr = []
arr.append(0)
for i in range(3):
	arr.append(int(input()))
ans1 = arr[1] + arr[2] + arr[3]
ans2 = (arr[1] + arr[2]) * arr[3]
ans3 = arr[1] * (arr[2] + arr[3])
ans4 = arr[1] * arr[2] * arr[3]
print(max((ans1, ans2, ans3, ans4)))


multiples = []
a = int(input())
b = int(input())
c = int(input())
multiples.append(a * b * c)
multiples.append(a * b + c)
multiples.append(a + b * c)
multiples.append(a + b + c)
multiples.append((a + b) * c)
multiples.append(a * (b + c))
max_products = max(multiples)
print(max_products)


(a_num, b_num, c_num) = (int(input()), int(input()), int(input()))
maximum = a_num + b_num + c_num
if (a_num + b_num) * c_num > maximum:
	maximum = (a_num + b_num) * c_num
if a_num * (b_num + c_num) > maximum:
	maximum = a_num * (b_num + c_num)
if a_num * b_num * c_num > maximum:
	maximum = a_num * b_num * c_num
print(maximum)


exec('a,b,c=' + 'int(input()),' * 3)
print(max(a + b + c, a * b * c, (a + b) * c, a * (b + c)))


x = int(input())
y = int(input())
z = int(input())
a = x + y + z
b = x * y * z
c = x + y * z
d = (x + y) * z
e = x * y + z
f = x * (y + z)
print(max(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
d = 0
if d < a + b + c:
	d = a + b + c
if d < a + b * c:
	d = a + b * c
if d < (a + b) * c:
	d = (a + b) * c
if d < a * b + c:
	d = a * b + c
if d < a * (b + c):
	d = a * (b + c)
if d < a * b * c:
	d = a * b * c
print(d)


a = int(input())
b = int(input())
c = int(input())
ar = []
ar.append(a * b * c)
ar.append(a + b + c)
ar.append(a * (b + c))
ar.append((a + b) * c)
ar.append(a * b + c)
ar.append(a + b * c)
print(max(ar))


def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = 1
while t:
	t -= 1
	n = int(fastinput())
	m = int(fastinput())
	x = int(fastinput())
	print(max(n * (m + x), (n + m) * x, n * m * x, n + m + x))


(A, B, C) = [int(input()) for i in 'ABC']
print(max(A * B * C, A * (B + C), (A + B) * C, A + B + C))


a = int(input())
b = int(input())
c = int(input())
m = a + b * c
n = a * (b + c)
x = a * b * c
y = (a + b) * c
z = a + b + c
k = a * b + c
f = a * b + c
j = a + b * c
s = max(m, n, x, y, z, k, f, j)
print(s)


total = 0
a = int(input())
b = int(input())
c = int(input())
total1 = a + b * c
total2 = a * (b + c)
total3 = a * b * c
total4 = (a + b) * c
total5 = a + b + c
lista = [total1, total2, total3, total4, total5]
num = 0
for i in range(5):
	if lista[i] > num:
		num = lista[i]
print(num)


a = int(input())
b = int(input())
c = int(input())
high = -1000
for i in ['+', '*']:
	for j in ['+', '*']:
		for k in ['+', '*']:
			e = eval(str(a) + i + str(b) + j + str(c))
			if e > high:
				high = e
			e = eval('(' + str(a) + i + str(b) + ')' + j + str(c))
			if e > high:
				high = e
			e = eval(str(a) + i + '(' + str(b) + j + str(c) + ')')
			if e > high:
				high = e
print(high)


A = int(input())
B = int(input())
C = int(input())
Q = A + B + C
W = A + B * C
E = A * B + C
R = A * B * C
T = (A + B) * C
Y = A * (B + C)
D = [Q, W, E, R, T, Y]
print(max(D))


(a, b, c) = [int(input()) for i in range(3)]
ans = max(a * (b + c), (a + b) * c, a * b * c, a + b + c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
f1 = a + b * c
f2 = a * (b + c)
f3 = a * b * c
f4 = (a + b) * c
f5 = a + b + c
all_f = [f1, f2, f3, f4, f5]
print(max(all_f))


a = int(input())
b = int(input())
c = int(input())
L = []
L.append(a + b + c)
L.append((a + b) * c)
L.append(a + b * c)
L.append(a * b + c)
L.append(a * (b + c))
L.append(a * b * c)
L = sorted(L)
print(int(L[5]))


(a, b, c) = (int(input()) for _ in range(3))
m = 0
if a == 1 and c == 1:
	m = 2 + b
elif a == 1:
	m = (a + b) * c
elif b == 1:
	m = max((a + b) * c, a * (b + c))
elif c == 1:
	m = a * (b + c)
else:
	m = a * b * c
print(m)


a = []
ans = 0
for i in range(3):
	a.append(int(input()))
if 1 not in a:
	ans = a[0] * a[1] * a[2]
else:
	ans = max((a[0] + a[1]) * a[2], a[0] * (a[1] + a[2]), a[0] + a[1] + a[2])
print(ans)


var0 = int(input())
var1 = int(input())
var2 = int(input())
temp = var0 * var1 * var2
if var0 == 1 or var1 == 1 or var2 == 1:
	if var0 == 1 and var1 == 1 and (var2 == 1):
		temp = var0 + var1 + var2
	elif var0 == 1 and var2 == 1:
		temp = var0 + var1 + var2
	elif var0 == 1:
		temp = (var0 + var1) * var2
	elif var1 == 1:
		if var0 < var2:
			temp = (var0 + var1) * var2
		else:
			temp = (var2 + var1) * var0
	elif var2 == 1:
		temp = (var2 + var1) * var0
else:
	temp = var0 * var1 * var2
print(temp)


def prob479a(a, b, c):
	i = a * b * c
	j = a + b + c
	k = (a + b) * c
	m = a * (b + c)
	alist = [i, j, k, m]
	max = i
	for item in alist:
		if item > max:
			max = item
	return max
a = int(input())
b = int(input())
c = int(input())
print(prob479a(a, b, c))


a = int(input())
b = int(input())
c = int(input())
retNum = max(a + b, a * b)
retNum = max(retNum + c, retNum * c)
otherNum = max(c + b, c * b)
otherNum = max(otherNum + a, otherNum * a)
print(max(retNum, otherNum))


a = int(input())
b = int(input())
c = int(input())
k1 = a + b * c
k2 = a * (b + c)
k3 = a * b * c
k4 = (a + b) * c
k5 = a + b + c
k6 = a * b + c
print(max(k1, k2, k3, k4, k5, k6))


a = int(input())
b = int(input())
c = int(input())
c1 = a + b + c
c2 = a * b + c
c3 = (a + b) * c
c4 = a * b * c
c5 = a * (b + c)
c6 = a + b * c
print(max(c1, c2, c3, c4, c5, c6))


a = int(input())
b = int(input())
c = int(input())
mx = -1
x1 = a + b * c
x2 = a * (b + c)
x3 = a * b * c
x4 = (a + b) * c
x5 = a + b + c
x6 = a * b + c
if x1 > x2:
	mx = x1
else:
	mx = x2
if x3 > mx:
	mx = x3
if x4 > mx:
	mx = x4
if x5 > mx:
	mx = x5
if x6 > mx:
	mx = x6
print(mx)


a = int(input())
b = int(input())
c = int(input())
p1 = a + b + c
p2 = a * (b + c)
p3 = a * b * c
p4 = (a + b) * c
p5 = a + b + c
p6 = a * b + c
print(max(p1, p2, p3, p4, p5, p6))


(a, b, c) = (int(input().strip()), int(input().strip()), int(input().strip()))
list_in = [a + b + c, a + b * c, a * b + c, (a + b) * c, a * (b + c), a * b * c]
print(max(list_in))


a = int(input())
b = int(input())
c = int(input())
s1 = (a + b) * c
s2 = a * (b + c)
s3 = a * b * c
s4 = a + b + c
print(max(s1, s2, s3, s4))


def getInt():
	return int(input())
a = getInt()
b = getInt()
c = getInt()
ans = a + b + c
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b + c)
ans = max(ans, a * b * c)
ans = max(ans, a + b * c)
print(ans)


numberl = []
for i in range(3):
	number = int(input())
	numberl.append(number)
a = numberl[0] + numberl[1] + numberl[2]
b = max(numberl[0] + numberl[1] * numberl[2], (numberl[0] + numberl[1]) * numberl[2])
c = max(numberl[0] * numberl[1] + numberl[2], numberl[0] * (numberl[1] + numberl[2]))
d = numberl[0] * numberl[1] * numberl[2]
print(max(a, b, c, d))


from functools import reduce
import operator

def prod(iterable):
	return reduce(operator.mul, iterable, 1)
a = int(input())
b = int(input())
c = int(input())
nums = [a, b, c]
if a == 1:
	b += 1
if c == 1:
	b += 1
if b == 1:
	if a > c:
		c += 1
	else:
		a += 1
print(prod([a, b, c]))


N = [int(input()) for x in range(3)]

def calc(N):
	a = N[0]
	b = N[1]
	c = N[2]
	if a == 1 or b == 1:
		X = a + b
	else:
		X = a * b
	if c == 1:
		X = X + c
	else:
		X = X * c
	return X
X = N
Y = [N[len(N) - 1 - x] for x in range(len(N))]
print(max(calc(X), calc(Y)))


a = int(input())
b = int(input())
c = int(input())
ans = []
ans.append(a + b + c)
ans.append(a * b * c)
ans.append(a * b + c)
ans.append(a + b * c)
ans.append(a * (b + c))
ans.append((a + b) * c)
print(max(ans))


x = int(input())
y = int(input())
z = int(input())
res = x * y * z
if x + y + z > res:
	res = x + y + z
if (x + y) * z > res:
	res = (x + y) * z
if x * (y + z) > res:
	res = x * (y + z)
if x * y + z > res:
	res = x * y + z
if x + y * z > res:
	res = x + y * z
print(res)


a = int(input())
b = int(input())
c = int(input())
Try1 = a + b * c
Try2 = a * b + c
Try3 = a * b * c
Try4 = (a + b) * c
Try5 = a + b + c
Try6 = a * (b + c)
print(max(Try1, Try2, Try3, Try4, Try5, Try6))


a = int(input())
b = int(input())
c = int(input())
max_n = a * b * c
max_n = a + b * c if a + b * c > max_n else max_n
max_n = a * (b + c) if a * (b + c) > max_n else max_n
max_n = a + b * c if a + b * c > max_n else max_n
max_n = (a + b) * c if (a + b) * c > max_n else max_n
max_n = a * b + c if a * b + c > max_n else max_n
max_n = a + b + c if a + b + c > max_n else max_n
print(max_n)


a = int(input())
b = int(input())
c = int(input())
max = 0
p = [0] * 101
p[0] = a + b * c
p[1] = a * b + c
p[2] = a * (b + c)
p[3] = (a + b) * c
p[4] = a + b + c
p[5] = a * b * c
for i in range(6):
	if p[i] > max:
		max = p[i]
print(max)


a = int(input())
b = int(input())
c = int(input())
p = []
p.append(a + b + c)
p.append(a * b * c)
p.append(a + b * c)
p.append(a * b + c)
p.append(a * (b + c))
p.append((a + b) * c)
print(max(p))


a = int(input())
b = int(input())
c = int(input())
list = [0, 0, 0, 0, 0, 0]
list[0] = a + b + c
list[1] = a * b + c
list[2] = a + b * c
list[3] = a * b * c
list[4] = (a + b) * c
list[5] = a * (b + c)
s = sorted(list)
print(s[5])


a = int(input())
b = int(input())
c = int(input())
x = list()
x.append(a + b + c)
x.append(a * b * c)
x.append(a + b * c)
x.append(a * b + c)
x.append((a + b) * c)
x.append(a * (b + c))
print(max(x))


a = int(input())
b = int(input())
c = int(input())
result = 0
if a == 1:
	result += a + b
	if c == 1:
		result += c
	else:
		result *= c
elif b == 1:
	if a < c:
		result = (a + b) * c
	else:
		result = a * (b + c)
elif c == 1:
	result = a * (b + c)
else:
	result = a * b * c
print(result)


a = int(input())
b = int(input())
c = int(input())
result = 0
step = a + b
step += c
if step > result:
	result = step
step = a * b
step += c
if step > result:
	result = step
step = a + b
step *= c
if step > result:
	result = step
step = a * b
step *= c
if step > result:
	result = step
step = a
step += b * c
if step > result:
	result = step
step = a
step *= b + c
if step > result:
	result = step
print(result)


def Alpha(x):
	if x == 1:
		return '*'
	else:
		return '+'
a = input()
b = input()
c = input()
L = []
for i in range(4):
	t = divmod(i, 2)
	A = eval(str(a + Alpha(t[0]) + b + Alpha(t[1]) + c))
	B = eval('(' + a + Alpha(t[0]) + b + ')' + Alpha(t[1]) + c)
	C = eval(a + Alpha(t[0]) + '(' + b + Alpha(t[1]) + c + ')')
	L.append(max(A, B, C))
print(max(L))


def prog():
	a = int(input())
	b = int(input())
	c = int(input())
	k = a + b + c
	if a * b + c > k:
		k = a * b + c
	if a + b * c > k:
		k = a + b * c
	if a * (b + c) > k:
		k = a * (b + c)
	if (a + b) * c > k:
		k = (a + b) * c
	if a * b * c > k:
		k = a * b * c
	print(k)
prog()


a = int(input())
b = int(input())
c = int(input())
list1 = []
list1.append((a + b) * c)
list1.append((c + b) * a)
list1.append(a * b * c)
list1.append(a + b + c)
print(max(list1))


(a, b, c) = [int(input()) for _ in range(3)]
print(max([a * b * c, a + b + c, a * b + c, (a + b) * c, a + b * c, a * (b + c)]))


num = []
for i in range(3):
	x = int(input())
	num.append(x)
a = (num[0] + num[1]) * num[2]
b = num[0] * num[1] * num[2]
c = num[0] * (num[1] + num[2])
d = num[0] + num[1] * num[2]
w = num[0] + num[1] + num[2]
print(max(a, b, c, d, w))


a = int(input())
b = int(input())
c = int(input())
list1 = [a, b, c]
arr = [a * b * c, a * b + c, a * (b + c), a + b + c, a + b * c, (a + b) * c]
print(max(arr))


a = int(input())
b = int(input())
c = int(input())
y = []
x = 0
y.append(a * b * c)
y.append(a * b + c)
y.append((a + b) * c)
y.append(a + b * c)
y.append(a * (b + c))
y.append(a + b + c)
x = max(y)
print(x)


a = int(input())
b = int(input())
c = int(input())
t1 = max(a + b, a * b)
t2 = max(b + c, b * c)
print(max(t1 * c, t1 + c, a * t2, a + t2))


a = []
for _ in range(3):
	a.append(int(input()))
x = a[0] * (a[1] + a[2])
z = a[2] * (a[1] + a[0])
w = a[0] * (a[1] * a[2])
v = sum(a)
print(max(x, z, w, v))


a = int(input())
b = int(input())
c = int(input())
ar = [a + b + c, (a + b) * c, a * (b + c), a * b * c]
ar.sort()
print(ar[3])


a = int(input())
b = int(input())
c = int(input())
(res1, res2, res3, res4, res5, res6) = (0, 0, 0, 0, 0, 0)
res1 = a + b * c
res2 = a * (b + c)
res3 = a * b * c
res4 = (a + b) * c
res5 = a + b + c
res6 = a * b + c
f = max(res1, res2, res3, res4, res5, res6)
print(f)


def OperacionMayor(a, b, c):
	Lista = []
	Lista.append(a + b + c)
	Lista.append((a + b) * c)
	Lista.append(a * (b + c))
	Lista.append(a * b * c)
	Lista.append(a + b * c)
	Lista.append(a * b + c)
	Lista.sort()
	return Lista[len(Lista) - 1]
a = int(input())
b = int(input())
c = int(input())
Mayor = OperacionMayor(a, b, c)
print(Mayor)


a = int(input())
b = int(input())
c = int(input())
arr = []
arr.append(a + b + c)
arr.append(a * b * c)
arr.append((a + b) * c)
arr.append(a + b * c)
arr.append(a * b + c)
arr.append(a * (b + c))
print(max(arr))


a = int(input())
b = int(input())
c = int(input())
sum_c = a + b + c
prod_c = a * b * c
sum_p1 = (a + b) * c
sum_p2 = (b + c) * a
X = [sum_c, sum_p1, sum_p2, prod_c]
print(max(X))


a = int(input())
b = int(input())
c = int(input())

def find(values, current):
	if len(values) == 0:
		return current
	else:
		max_value = 0
		num = values[0]
		max_value = max(max_value, find(values[1:], current + num))
		max_value = max(max_value, find(values[1:], current * num))
		return max_value
print(max(find([a, b, c], 0), find([c, b, a], 0)))


def mental(a, b, c):
	if a == 1 and c == 1:
		return 2 + b
	elif a == 1:
		return (a + b) * c
	elif b == 1:
		return max((a + b) * c, a * (b + c))
	elif c == 1:
		return a * (b + c)
	else:
		return a * b * c

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	print(mental(a, b, c))
main()


l = int(input())
m = int(input())
n = int(input())
l1 = l + m + n
l2 = l + m * n
l3 = l * m + n
l4 = (l + m) * n
l5 = l * (m + n)
l6 = l * m * n
print(max(l1, l2, l3, l4, l5, l6))


def max_expression_value(a, b, c):
	max_value = -1
	for i in [0, 1]:
		if i == 0:
			for j in [0, 1]:
				rhs = b + c if j == 0 else b * c
				result = a + rhs
				if result > max_value:
					max_value = result
			lhs = a + b
			for j in [0, 1]:
				result = lhs + c if j == 0 else lhs * c
				if result > max_value:
					max_value = result
		else:
			for j in [0, 1]:
				rhs = b + c if j == 0 else b * c
				result = a * rhs
				if result > max_value:
					max_value = result
			lhs = a * b
			for j in [0, 1]:
				result = lhs + c if j == 0 else lhs * c
				if result > max_value:
					max_value = result
	return max_value

def run_alg():
	a = int(input())
	b = int(input())
	c = int(input())
	print(max_expression_value(a, b, c))
run_alg()


a = int(input())
b = int(input())
c = int(input())
e1 = a + b + c
e2 = a * b * c
e3 = a + b * c
e4 = a * b + c
e5 = (a + b) * c
e6 = a * b + c
e7 = a * (b + c)
e8 = a + b * c
print(max(e1, max(e2, max(e3, max(e4, max(e5, max(e6, max(e7, e8))))))))


a = int(input())
b = int(input())
c = int(input())
values = []
values.append(a * b * c)
values.append(a * (b * c))
values.append((a + b) * c)
values.append(a + b * c)
values.append(a * (b + c))
values.append(a * b + c)
values.append(a + b + c)
print(max(values))


a = int(input())
b = int(input())
c = int(input())
x = [1, 2, 3, 4, 5, 6]
x[4] = a + b + c
x[0] = a + b * c
x[5] = a * b + c
x[2] = a * b * c
x[1] = a * (b + c)
x[3] = (a + b) * c
print(max(x))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and c == 1:
	print(2 + b)
elif a == 1:
	print((a + b) * c)
elif b == 1:
	print(max((a + b) * c, a * (b + c)))
elif c == 1:
	print(a * (b + c))
else:
	print(a * b * c)


def sol(a, b, c):
	if a == 1 and c == 1:
		return 2 + b
	elif a == 1:
		return (a + b) * c
	elif b == 1:
		return max((a + b) * c, a * (b + c))
	elif c == 1:
		return a * (b + c)
	else:
		return a * b * c
a = int(input())
b = int(input())
c = int(input())
print(sol(a, b, c))


x = eval(input())
y = eval(input())
z = eval(input())
L = [x * y * z, x + y + z, (x + y) * z, x * y + z, x + y * z, x * (y + z)]
flag = L[0]
i = 0
while i <= 5:
	if L[i] > flag:
		flag = L[i]
	i = i + 1
print(flag)


a = []
a.append(input())
a.append(input())
a.append(input())
o = [['+', '+'], ['+', '*'], ['*', '+'], ['*', '*']]
e = []
d = 0
for x in o:
	b = a[:]
	b.insert(1, x[0])
	b.insert(3, x[1])
	for y in range(42):
		c = b[:]
		c.insert(y % 6, ')')
		c.insert(y % 7, '(')
		e.append(c)
for x in e:
	try:
		f = eval(''.join(x))
		d = max(f, d)
	except:
		continue
print(d)


a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a + b * c)
l.append(a * (b + c))
l.append(a * b * c)
l.append((a + b) * c)
l.append(a + b + c)
l.append(a * b + c)
max = l[0]
for i in range(len(l)):
	if max < l[i]:
		max = l[i]
print(max)


a = int(input())
b = int(input())
c = int(input())
(l1, l2, l3) = ([], [], [])
if a > c:
	x1 = b * c
	l1.append(x1)
	x2 = b + c
	l1.append(x2)
	y1 = max(l1)
	z1 = a + y1
	l2.append(z1)
	z2 = a * y1
	l2.append(z2)
	print(max(l2))
else:
	x1 = a * b
	l1.append(x1)
	x2 = a + b
	l1.append(x2)
	y1 = max(l1)
	z1 = c + y1
	l2.append(z1)
	z2 = c * y1
	l2.append(z2)
	print(max(l2))


a = int(input())
b = int(input())
c = int(input())
d = []
d.append(a * b * c)
d.append((a + b) * c)
d.append((c + b) * a)
d.append(a + b + c)
e = max(d)
print(e)


a = int(input())
b = int(input())
c = int(input())
if a * b * c >= (a + b) * c and a * b * c >= a * (b + c) and (a * b * c >= a + b + c) and (a * b * c >= a * b + c) and (a * b * c >= a + b * c):
	print(a * b * c)
elif (a + b) * c >= a * b * c and (a + b) * c >= a * (b + c) and ((a + b) * c >= a + b + c) and ((a + b) * c >= a * b + c) and ((a + b) * c >= a + b * c):
	print((a + b) * c)
elif a * (b + c) >= (a + b) * c and a * (b + c) >= a * b * c and (a * (b + c) >= a + b + c) and (a * (b + c) >= a * b + c) and (a * (b + c) >= a + b * c):
	print(a * (b + c))
elif a + b + c >= a * b * c and a + b + c >= a * (b + c) and (a + b + c >= (a + b) * c) and (a + b + c >= a * b + c) and (a + b + c >= a + b * c):
	print(a + b + c)
elif a * b + c >= a + b + c and a * b + c >= a * b * c and (a * b + c >= (a + b) * c) and (a * b + c >= a * (b + c)) and (a * b + c >= a + b * c):
	print(a * b + c)
else:
	print(a + b * c)


a = int(input())
b = int(input())
c = int(input())
if a == 1 or b == 1 or c == 1:
	if (a + b) * c > a * (b + c) and (a + b) * c > a + b + c:
		print((a + b) * c)
	elif a * (b + c) > a + b + c:
		print(a * (b + c))
	else:
		print(a + b + c)
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = a * (b + c)
z = a * b * c
s = (a + b) * c
print(max(x, z, y, s))


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
import heapq
infinite = float('inf')
a = int(input())
b = int(input())
c = int(input())
temp = a * b * c
temp = max(temp, (a + b) * c)
temp = max(temp, a * (b + c))
temp = max(temp, a + b + c)
print(temp)


a = int(input())
b = int(input())
c = int(input())
expressions = []
expressions.append(a + b + c)
expressions.append(a * b * c)
expressions.append((a + b) * c)
expressions.append(a * b + c)
expressions.append(a * (b + c))
expressions.append(a + b * c)
print(max(expressions))


a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
ans = []
ans.append(a[0] + a[1] * a[2])
ans.append(a[0] * a[1] + a[2])
ans.append(a[0] * a[1] * a[2])
ans.append(a[0] + a[1] + a[2])
ans.append((a[0] + a[1]) * a[2])
ans.append(a[0] * (a[1] + a[2]))
print(max(ans))


a = int(input())
b = int(input())
c = int(input())
my_list = []
x = a + b * c
y = a * (b + c)
z = a * b * c
k = (a + b) * c
p = a * b + c
q = a + b + c
my_list.append(x)
my_list.append(y)
my_list.append(z)
my_list.append(k)
my_list.append(p)
my_list.append(q)
print(max(my_list))


j = []
for e in range(3):
	a = int(input())
	j.append(a)
a = j[0]
b = j[1]
c = j[2]
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


a = int(input())
b = int(input())
c = int(input())
k = 0
if a + b + c > k:
	k = a + b + c
if a + b * c > k:
	k = a + b * c
if a * b + c > k:
	k = a * b + c
if a * b * c > k:
	k = a * b * c
if (a + b) * c > k:
	k = (a + b) * c
if a * (b + c) > k:
	k = a * (b + c)
print(k)


a = int(input())
b = int(input())
c = int(input())
D = a + b + c
E = a + b * c
F = a * b + c
G = (a + b) * c
H = a * (b + c)
J = a * b * c
print(max(D, E, F, G, H, J))


a = int(input())
b = int(input())
c = int(input())
o = []
o.append(a * b * c)
o.append(a * b + c)
o.append(a + b * c)
o.append(a + b + c)
o.append((a + b) * c)
o.append(a * (b + c))
print(max(o))


a = int(input())
b = int(input())
c = int(input())
q = a + b + c
w = a * b + c
e = a + b * c
r = (a + b) * c
t = a * (b + c)
y = a * b * c
print(max(q, w, e, r, t, y))


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	b += 1
if c == 1:
	b += 1
if b == 1:
	if a < c:
		a += 1
	else:
		c += 1
print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
ma = 0
if a + b * c > ma:
	ma = a + b * c
if a * (b + c) > ma:
	ma = a * (b + c)
if a * b * c > ma:
	ma = a * b * c
if (a + b) * c > ma:
	ma = (a + b) * c
if a * b + c > ma:
	ma = a * b + c
if a + b + c > ma:
	ma = a + b + c
print(ma)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	print(max(a + b + c, a * b * c, (a + b) * c, a + b * c, a * b + c, a * (b + c)))
main()


a = int(input())
b = int(input())
c = int(input())
if a + b + c == 3:
	print(3)
elif a == 1:
	if b == 1:
		print(2 * c)
	elif c == 1:
		print(b + 2)
	else:
		print((1 + b) * c)
elif b == 1:
	if c == 1:
		print(a * 2)
	elif a < c:
		print(c * (a + 1))
	else:
		print(a * (c + 1))
elif c == 1:
	print(a * (b + 1))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
if a == 1 and c == 1:
	m = a + b + c
elif a == 1 and b == 1 and (c != 1):
	m = 2 * c
elif a != 1 and b == 1 and (c == 1):
	m = 2 * a
elif l.count(1) == 1:
	if a == 1:
		m = (1 + b) * c
	elif b == 1:
		m = a * c + max(l)
	else:
		m = a * (b + 1)
else:
	m = a * b * c
print(m)


def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	expr1 = a * (b + c)
	expr2 = (a + b) * c
	expr3 = a + b + c
	expr4 = a * b * c
	print(max(expr1, expr2, expr3, expr4))
solve()


from builtins import int
a = int(input())
b = int(input())
c = int(input())
value1 = a + b + c
value2 = a + b * c
value3 = a * b + c
value4 = (a + b) * c
value5 = a * (b + c)
value6 = a * b * c
print(max(value1, value2, value3, value4, value5, value6))


(a, b, c) = (int(input()) for i in range(3))
exp = []
exp.append(a + b + c)
exp.append(a + b * c)
exp.append(a * b + c)
exp.append(a * b * c)
exp.append(a * (b + c))
exp.append((a + b) * c)
print(max(exp))


a = int(input())
b = int(input())
c = int(input())
Max = a + b + c
if a * b * c > Max:
	Max = a * b * c
if (a + b) * c > Max:
	Max = (a + b) * c
if a * (b + c) > Max:
	Max = a * (b + c)
print(Max)


num1 = int(input())
num2 = int(input())
num3 = int(input())
print(max([(num1 + num2) * num3, num1 * num2 * num3, num1 * (num2 + num3), num1 + num2 + num3]))


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
o = (a + b) * c
p = a + b + c
print(max(x, y, z, o, p))


a = int(input())
b = int(input())
c = int(input())
v1 = a + b + c
v2 = a + b * c
v3 = a * b + c
v4 = a * b * c
v5 = (a + b) * c
v6 = a * (b + c)
print(max(v1, v2, v3, v4, v5, v6))


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = a * b * c
p = (a + b) * c
q = a * (b + c)
w = []
w.append(x)
w.append(y)
w.append(p)
w.append(q)
print(max(w))


import math
a = int(input(''))
b = int(input(''))
c = int(input(''))
s = []
s.append(a + b * c)
s.append(a * (b + c))
s.append(a * b * c)
s.append((a + b) * c)
s.append(a + b + c)
print(max(s))


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
elif a != 1 and b == 1 and (c != 1):
	m = max(a, c)
	n = min(a, c)
	print((n + b) * m)
elif a == 1 and c == 1:
	print(a + b + c)
elif a != 1 and c == 1:
	print(a * (b + c))
elif a == 1 and c != 1:
	print((a + b) * c)


n = int(input())
m = int(input())
t = int(input())
max_ = -1
if n == 1 or m == 1 or t == 1:
	if n + m + t > max_:
		max_ = n + m + t
	if (n + m) * t > max_:
		max_ = (n + m) * t
	if (m + t) * n > max_:
		max_ = (m + t) * n
	if n * m * t > max_:
		max_ = n * m * t
	if n + m * t > max_:
		max_ = n + m * t
	if t + n * m > max_:
		max_ = t + n * m
	print(max_)
else:
	print(n * m * t)


a = int(input())
b = int(input())
c = int(input())
ex = a + b + c
ex1 = (a + b) * c
ex2 = a * b + c
ex3 = a * b * c
ex4 = a * (b + c)
ex5 = a + b * c
if ex >= ex1 and ex >= ex2 and (ex >= ex3) and (ex >= ex4) and (ex >= ex5):
	print(ex)
elif ex1 >= ex and ex1 >= ex2 and (ex1 >= ex3) and (ex1 >= ex4) and (ex1 >= ex5):
	print(ex1)
elif ex2 >= ex and ex2 >= ex1 and (ex2 >= ex3) and (ex2 >= ex4) and (ex2 >= ex5):
	print(ex2)
elif ex3 >= ex and ex3 >= ex1 and (ex3 >= ex2) and (ex3 >= ex4) and (ex3 >= ex5):
	print(ex3)
elif ex4 >= ex and ex4 >= ex1 and (ex4 >= ex2) and (ex4 >= ex3) and (ex4 >= ex5):
	print(ex4)
else:
	print(ex5)


numbers = []
for i in range(3):
	numbers.append(int(input()))
(a, b, c) = (numbers[0], numbers[1], numbers[2])
nums = [0, 0, 0, 0, 0, 0]
nums[0] = a + b + c
nums[1] = a + b * c
nums[2] = a * b + c
nums[3] = a * b * c
nums[4] = a * (b + c)
nums[5] = (a + b) * c
print(max(nums))


a = int(input())
b = int(input())
c = int(input())
ans1 = a + b * c
ans2 = a * (b + c)
ans3 = a * b * c
ans4 = (a + b) * c
ans5 = a + b + c
print(max(ans1, ans2, ans3, ans4, ans5))


a = int(input())
b = int(input())
c = int(input())
res = []
res.append(a * b * c)
res.append(a + b + c)
res.append((a + b) * c)
res.append(a * (b + c))
res.append(a + b * c)
res.append(a * b + c)
print(max(res))


a = int(input())
b = int(input())
c = int(input())
x = a * b * c
y = (a + b) * c
z = a * (b + c)
i = a + b * c
t = a * b + c
o = a + b + c
m = max(i, t, x, y, z, t, o)
print(m)


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
elif a == 1 and b == 1 and (c == 1):
	print(a + b + c)
elif a == 1 and b != 1 and (c != 1):
	print((a + b) * c)
elif a != 1 and b == 1 and (c != 1):
	print(max(a + b * c, (a + b) * c, a * b + c, a * (b + c)))
elif a != 1 and b != 1 and (c == 1):
	print(a * (b + c))
elif a == 1 and b == 1 and (c != 1):
	print((a + b) * c)
elif a != 1 and b == 1 and (c == 1):
	print(a * (b + c))
elif a == 1 and b != 1 and (c == 1):
	print(a + b + c)


a = int(input())
b = int(input())
c = int(input())
s = a + b + c
s1 = a * b * c
s2 = (a + b) * c
s3 = a * b + c
s4 = a + b * c
s5 = a * (b + c)
a = []
a += (s, s1, s2, s3, s4, s5)
a.sort()
a.reverse()
print(a[0])


a = int(input())
b = int(input())
c = int(input())
r = []
sum = a + b + c
r.append(sum)
mul = a * b * c
r.append(mul)
t1 = a * (b + c)
t2 = a + b * c
t3 = (a + b) * c
t4 = a * b + c
r.append(t1)
r.append(t2)
r.append(t3)
r.append(t4)
print(max(r))


x = []
a = int(input())
b = int(input())
c = int(input())
d = a + b * c
x.append(d)
e = a * (b + c)
x.append(e)
f = a * b * c
x.append(f)
g = (a + b) * c
x.append(g)
h = a + b + c
x.append(h)
print(max(x))


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
t = []
t.append(a + b + c)
t.append(a * b + c)
t.append(a + b * c)
t.append(a * b * c)
t.append(a * (b + c))
t.append((a + b) * c)
print(max(t))


n1 = int(input())
n2 = int(input())
n3 = int(input())
s1 = (n1 + n2) * n3
s2 = n1 * n2 + n3
s3 = n1 * (n2 + n3)
s4 = n1 + n2 * n3
s5 = n1 + n2 + n3
s6 = n1 * n2 * n3
m1 = max(s1, s2)
m2 = max(s3, s4)
m3 = max(s5, s6)
m1 = max(m1, m2)
print(max(m1, m3))


a = input()
b = input()
c = input()
a = int(a)
b = int(b)
c = int(c)
k = 0
m = [0, 0, 0, 0, 0]
m[4] = a + b + c
m[0] = b * c + a
m[1] = (b + c) * a
m[2] = a * b * c
m[3] = (a + b) * c
for i in range(len(m)):
	if m[i] > k:
		k = m[i]
print(k)


a = int(input())
b = int(input())
c = int(input())
x0 = (a + b) * c
x1 = a * b * c
x2 = (b + c) * a
x3 = a + b + c
if x0 > x1:
	m = x0
else:
	m = x1
if x2 > x3:
	n = x2
else:
	n = x3
if m > n:
	print(m)
else:
	print(n)


a = int(input())
b = int(input())
c = int(input())
n1 = a + b + c
n2 = a * b + c
n3 = a * (b + c)
n4 = a + b * c
n5 = (a + b) * c
n6 = a * b * c
print(max(n1, n2, n3, n4, n5, n6))


a = int(input())
b = int(input())
c = int(input())
f = []
f.append(a * b * c)
f.append(a * b + c)
f.append(a * (b + c))
f.append(a + b * c)
f.append((a + b) * c)
f.append(a + b + c)
print(max(f))


a = int(input())
b = int(input())
c = int(input())
sol = 0
sol = max(sol, a + b + c)
sol = max(sol, (a + b) * c)
sol = max(sol, a * (b + c))
sol = max(sol, (a + b) * c)
sol = max(sol, a * b + c)
sol = max(sol, a + b * c)
sol = max(sol, a * b * c)
print(sol)


from sys import stdin

def main():
	(a, b, c) = (int(stdin.readline().strip()) for _ in (0, 0, 0))
	return max((a + b + c, (a + b) * c, a * (b + c), a + b * c, a * b + c, a * b * c))
print(main())


(a, b, c) = (int(input()), int(input()), int(input()))
d = a + b + c
e = a + b * c
f = a * (b + c)
g = a * b * c
i = a * b + c
k = (a + b) * c
m = max(e, f, g, i, k, d)
print(m)


def get_values():
	a = int(input())
	b = int(input())
	c = int(input())
	result = []
	result.append(a + b + c)
	result.append(a * b * c)
	result.append(a * (b + c))
	result.append((a + b) * c)
	result.append(a * b + c)
	result.append(a + b * c)
	return print(max(result))
get_values()


a = int(input())
b = int(input())
c = int(input())
my_list = []
my_list.append(a + b + c)
my_list.append((a + b) * c)
my_list.append(a * b + c)
my_list.append(a + b * c)
my_list.append(a * (b + c))
my_list.append(a * b * c)
my_list.sort()
print(my_list[-1])


a = int(input())
b = int(input())
c = int(input())
e = [0] * 10
e[0] = a * b * c
e[1] = (a + b) * c
e[2] = a * (b + c)
e[3] = a + b * c
e[4] = a * b + c
e[5] = a + b + c
print(max(e))


a = int(input())
b = int(input())
c = int(input())
l1 = a + b + c
l2 = a * b * c
l3 = a * b + c
l4 = a + b * c
l5 = (a + b) * c
l6 = a * (b + c)
ans = max(l1, l2, l3, l4, l5, l6)
print(ans)


def solve(a, b, c):
	if a == 1 and b == 1 and (c == 1):
		return 3
	if a == 1 and c == 1:
		return 2 + b
	elif a == 1:
		return (a + b) * c
	elif b == 1:
		return max((a + b) * c, a * (b + c))
	elif c == 1:
		return a * (b + c)
	else:
		return a * b * c
a = int(input())
b = int(input())
c = int(input())
print(solve(a, b, c))


m = int(input())
n = int(input())
p = int(input())
print(max([m + n + p, m + n * p, m * n + p, m * n * p, (m + n) * p, m * (n + p), m * p + n, m * (n + p)]))


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	b += a
	if c == 1:
		print(b + c)
	else:
		print(b * c)
elif b == 1:
	print(max((a + b) * c, a * (b + c)))
elif c == 1:
	print(a * (b + c))
else:
	print(a * b * c)


from sys import stdin, stdout
a = int(stdin.readline().strip())
b = int(stdin.readline().strip())
c = int(stdin.readline().strip())
r = [0, 0, 0, 0]
r[0] = a + b + c
r[1] = a * b * c
r[2] = (a + b) * c
r[3] = a * (b + c)
stdout.write(str(max(r)))


a = int(input())
b = int(input())
c = int(input())
n = a + b * c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
m = a + b + c
print(max(n, x, y, z, m))


def max_val(a, b, c):
	return max([a * (b + c), a + b * c, a * (b * c), a + (b + c), (a + b) * c, a * b + c, a + b + c, a * b * c, a + b * c, a * b + c, a + b + c, a * b * c])

def main():
	(a, b, c) = [int(input()) for _ in range(3)]
	print(max_val(a, b, c))
main()


a = int(input())
b = int(input())
c = int(input())
lst = ['a+b*c', 'a*(b+c)', 'a*b*c', '(a+b)*c', 'a+b+c']
Max = 0
for i in lst:
	if eval(i) > Max:
		Max = eval(i)
print(Max)


from collections import deque
import math
a = int(input())
b = int(input())
c = int(input())
answer = 0
if a == 1:
	b = b + 1
if c == 1:
	b += 1
if b == 1:
	if a > c:
		c += 1
	else:
		a += 1
print(a * b * c)


def get():
	return int(input())
a = get()
b = get()
c = get()
print(max(max((a + b) * c, a * (b + c)), max(a * b * c, a + b + c)))


a = int(input())
b = int(input())
c = int(input())
d = 0
d = max(d, a + b * c)
d = max(d, a * (b + c))
d = max(d, a * b * c)
d = max(d, (a + b) * c)
d = max(d, a + b + c)
print(d)


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
if a * (b + c) > x:
	x = a * (b + c)
if a * b * c > x:
	x = a * b * c
if (a + b) * c > x:
	x = (a + b) * c
print(x)


x = int(input())
y = int(input())
z = int(input())
m = 0
if x + y + z > m:
	m = x + y + z
if x * y * z > m:
	m = x * y * z
if x + y * z > m:
	m = x + y * z
if x * (y + z) > m:
	m = x * (y + z)
if x * y + z > m:
	m = x * y + z
if (x + y) * z > m:
	m = (x + y) * z
print(m)


x = int(input())
y = int(input())
z = int(input())
sum = 0

def max(y, z):
	if y + z >= y * z:
		return y + z
	else:
		return y * z
sum1 = max(x, max(y, z))
sum2 = max(max(x, y), z)
if sum1 >= sum2:
	print(sum1)
else:
	print(sum2)


a = int(input())
b = int(input())
c = int(input())
s = 0
if a == 1:
	if c == 1:
		s = a + b + c
	else:
		s = (a + b) * c
elif b == 1:
	if c > a:
		s = (a + b) * c
	else:
		s = a * (b + c)
elif c == 1:
	s = a * (b + c)
else:
	s = a * b * c
print(s)


a = int(input())
b = int(input())
c = int(input())
multip = a * b * c
multip1 = (a + b) * c
multip2 = a * (b + c)
multip3 = a + b * c
multip4 = a * b + c
multip5 = a + b + c
print(max(multip, multip1, multip2, multip3, multip4, multip5))


a = int(input())
b = int(input())
c = int(input())
m = [a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c)]
m.sort()
print(m[5])


a = int(input())
b = int(input())
c = int(input())
s = []
s1 = a + b * c
s.append(s1)
s2 = a * b + c
s.append(s2)
s3 = a * (b + c)
s.append(s3)
s4 = a * b * c
s.append(s4)
s5 = a + b * c
s.append(s5)
s6 = (a + b) * c
s.append(s6)
s7 = a * b + c
s.append(s7)
s8 = a + b + c
s.append(s8)
print(max(s))


def maks(data):
	hasil = 0
	for i in data:
		if int(i) > hasil:
			hasil = int(i)
	return hasil
a = int(input())
b = int(input())
c = int(input())
array = []
array += [a + b * c]
array += [a * b + c]
array += [a + b + c]
array += [a * b * c]
array += [(a + b) * c]
array += [a * (b + c)]
print(maks(array))


def main():
	from sys import stdin, stdout
	a = int(stdin.readline())
	b = int(stdin.readline())
	c = int(stdin.readline())
	maxim = a * b * c
	if a + b + c > maxim:
		maxim = a + b + c
	if (a + b) * c > maxim:
		maxim = (a + b) * c
	if a * (b + c) > maxim:
		maxim = a * (b + c)
	if a + b * c > maxim:
		maxim = a + b * c
	stdout.write(str(maxim))
main()


a = int(input())
b = int(input())
c = int(input())
x1 = a + b + c
x2 = a + b * c
x3 = a * b + c
x4 = a * b * c
x5 = a * (b + c)
x6 = (a + b) * c
print(max(x1, x2, x3, x4, x5, x6))


import math

def solve(i, j, k):
	return max((i + j) * k, i * (j + k), i * j * k, (i + j) * k, i + j + k)
i = int(input())
j = int(input())
k = int(input())
result = solve(i, j, k)
print(result)


a1 = input('')
a2 = input('')
a3 = input('')
a = int(a1)
b = int(a2)
c = int(a3)
n = a + b + c
i = a * b * c
j = (a + b) * c
m = a * (b + c)
k = a * b + c
s = a + b * c
print(max(n, i, j, m, k, s))


a = int(input())
b = int(input())
c = int(input())
l = sorted([a, b, c])
print(max(a + b * c, a * (b + c), a * b * c, a + b + c, (a + b) * c))


from sys import stdin
a = int(stdin.readline().strip())
b = int(stdin.readline().strip())
c = int(stdin.readline().strip())
s1 = a + b + c
s2 = a * b * c
s3 = a + b * c
s4 = a * b + c
s5 = (a + b) * c
s6 = a * (b + c)
if s1 >= s2 and s1 >= s3 and (s1 >= s4) and (s1 >= s5) and (s1 >= s6):
	print(s1)
elif s2 >= s1 and s2 >= s3 and (s2 >= s4) and (s2 >= s5) and (s2 >= s6):
	print(s2)
elif s3 >= s1 and s3 >= s2 and (s3 >= s4) and (s3 >= s5) and (s3 >= s6):
	print(s3)
elif s4 >= s1 and s4 >= s2 and (s4 >= s3) and (s4 >= s5) and (s4 >= s6):
	print(s4)
elif s5 >= s1 and s5 >= s2 and (s5 >= s3) and (s5 >= s4) and (s5 >= s6):
	print(s5)
elif s6 >= s1 and s6 >= s2 and (s6 >= s3) and (s6 >= s4) and (s6 >= s5):
	print(s6)


a = int(input())
b = int(input())
c = int(input())
val1 = (a + b) * c
val2 = a * (b + c)
val3 = a + b + c
val4 = a * b * c
val5 = a + b * c
val5 = a * b + c
print(max(val1, val2, val3, val4, val5))


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
g = min(l)
if g == 1:
	if a == b == c:
		utk = a + b + c
	elif a == 1:
		if b == 1:
			utk = (a + b) * c
		elif c == 1:
			utk = a + b + c
		else:
			utk = (a + b) * c
	elif b == 1:
		if c == 1:
			utk = a * (b + c)
		elif a > c:
			utk = a * (b + c)
		else:
			utk = (a + b) * c
	else:
		utk = a * (b + c)
else:
	utk = a * b * c
print(utk)


l = []
a = int(input())
b = int(input())
c = int(input())
l.extend([a * b * c, a + b + c, a + b * c, a * b + c, (a + b) * c, a * (b + c)])
print(max(l))


a = int(input())
b = int(input())
c = int(input())
max = 0
r = list(range(6))
r[0] = a + b * c
r[1] = a + b + c
r[2] = a * b + c
r[3] = a * b * c
r[4] = (a + b) * c
r[5] = a * (b + c)
for i in range(6):
	if r[i] > max:
		max = r[i]
print(max)


a = input()
b = input()
c = input()
list = [0]
list.append(int(a) * int(b) + int(c))
list.append(int(a) * (int(b) + int(c)))
list.append(int(a) * int(b) * int(c))
list.append((int(a) + int(b)) * int(c))
list.append(int(a) + int(b) * int(c))
list.append(int(a) + int(b) * int(c))
list.append(int(a) + int(b) + int(c))
print(max(list))


nums = []
nums.append(int(input()))
nums.append(int(input()))
nums.append(int(input()))
Max = 0

def add(a, b):
	return a + b

def mul(a, b):
	return a * b
Op = {0: add, 1: mul}
for x in range(0, 2):
	n1 = nums[x]
	n2 = nums[(x + 1) % 3]
	n3 = nums[(x + 2) % 3]
	for op in range(0, 4):
		temp = Op[op // 2](Op[op % 2](n1, n2), n3)
		if temp > Max:
			Max = temp
print(Max)


A = int(input())
B = int(input())
C = int(input())

def getAnswer():
	return max(A + B * C, A * (B + C), A * B * C, (A + B) * C, A + B + C)
print(getAnswer())


a = int(input())
b = int(input())
c = int(input())
plus = a + b + c
goon = a * b * c
p1 = a * (b + c)
p2 = (a + b) * c
p4 = a + b * c
p5 = a * b + c
lis = [plus, goon, p1, p2, p4, p5]
print(max(lis))


import sys
import math
a = int(input())
b = int(input())
c = int(input())
ans = 0
if a + b + c > ans:
	ans = a + b + c
if (a + b) * c > ans:
	ans = (a + b) * c
if a + b * c > ans:
	ans = a + b * c
if a * b + c > ans:
	ans = a * b + c
if a * (b + c) > ans:
	ans = a * (b + c)
if a * b * c > ans:
	ans = a * b * c
print(ans)


a = int(input())
b = int(input())
c = int(input())
k = list(map(int, (a, b, c)))
k0 = k[0] + k[1] + k[2]
k1 = k[0] + k[1] * k[2]
k2 = k[0] * k[1] * k[2]
r1 = list(map(int, ((k[0] + k[1]) * k[2], (k[1] + k[2]) * k[0])))
t = sorted(r1)[-1]
r2 = list(map(int, (k0, k1, k2, t)))
if a == b == c == 1:
	print(3)
else:
	print(sorted(r2)[-1])


a = int(input())
b = int(input())
c = int(input())

def solve(a, b, c):
	r1 = (a + b) * c
	r2 = a * (b + c)
	r3 = a + b + c
	r4 = a * b * c
	r5 = a * b + c
	r6 = a + b * c
	return max([r1, r2, r3, r4, r5, r6])
print(solve(a, b, c))


l = [int(input()) for i in range(3)]
if all([i == 1 for i in l]):
	print(3)
elif l[0] == 1 and l[2] == 1:
	print(sum(l))
elif l[1] == 1:
	l.pop(1)
	print((min(l) + 1) * max(l))
elif l[0] == 1:
	print((l[1] + 1) * l[2])
elif l[2] == 1:
	print((l[1] + 1) * l[0])
else:
	print(l[0] * l[1] * l[2])


R = lambda : int(input())
a = R()
b = R()
c = R()
print(max(a + b + c, (a + b) * c, a * (b + c), a * b * c))


d1 = int(input())
d2 = int(input())
d3 = int(input())
operations_list = [d1 + d2 + d3, d1 + d2 * d3, d1 * d2 + d3, (d1 + d2) * d3, d1 * (d2 + d3), d1 * d2 * d3]
result = 0
for el in operations_list:
	calc = el
	if calc > result:
		result = calc
print(result)


a = int(input())
b = int(input())
c = int(input())
maxi = 0
if a + b * c > maxi:
	maxi = a + b * c
if a * b + c > maxi:
	maxi = a * b + c
if a * (b + c) > maxi:
	maxi = a * (b + c)
if (a + b) * c > maxi:
	maxi = (a + b) * c
if a * b * c > maxi:
	maxi = a * b * c
if a + b + c > maxi:
	maxi = a + b + c
print(maxi)


a = int(input())
b = int(input())
c = int(input())
a1 = (a + b) * c
b1 = a * (b + c)
c1 = a + b * c
d1 = a * b * c
i1 = a + b + c
print(max(a1, b1, c1, d1, i1))


a = int(input())
b = int(input())
c = int(input())
list2 = []
list2.append(a + b + c)
list2.append(a + b * c)
list2.append(a * b + c)
list2.append(a * b * c)
list2.append((a + b) * c)
list2.append(a * (b + c))
print(max(list2))


def _max(a, b, c):
	if a == b == c == 1 or (a == 1 and c == 1):
		return a + b + c
	elif b == 1 and a > c or c == 1:
		return a * (b + c)
	elif b == 1 and a <= c or a == 1:
		return (a + b) * c
	else:
		return a * b * c
a = int(input())
b = int(input())
c = int(input())
print(_max(a, b, c))


a = eval(input())
b = eval(input())
c = eval(input())
g = [a + b + c, a * b * c, a + b * c, a * b + c, (a + b) * c, a * (b + c)]
i = 1
n = len(g)
max = g[0]
while i < n:
	if max < g[i]:
		max = g[i]
	i = i + 1
print(max)


a = int(input())
b = int(input())
c = int(input())
m = a + b * c
n = a + b + c
v = a * b * c
x = a * b + c
z = (a + b) * c
l = a * (b + c)
print(max(m, n, v, x, z, l))


a = int(input())
b = int(input())
c = int(input())
d = (a + b) * c
e = a * (b + c)
f = a + b + c
h = a * b * c
y = max([d, e, f, h])
print(y)


(x, y, z) = [int(input()) for i in range(3)]
print(max([x + y + z, x * y * z, x * y + z, y * z + x, (x + y) * z, (y + z) * x]))


a = int(input())
b = int(input())
c = int(input())
maxx = -1
ans1 = a + b + c
if ans1 > maxx:
	maxx = ans1
ans2 = a * b * c
if ans2 > maxx:
	maxx = ans2
ans3 = (a + b) * c
if ans3 > maxx:
	maxx = ans3
ans4 = a * (b + c)
if ans4 > maxx:
	maxx = ans4
print(maxx)


n = int(input())
t = int(input())
x = int(input())
if n == t and t == x and (x == 1):
	print(n + t + x)
elif n == x == 1:
	print(n + t + x)
elif n == 1:
	print((n + t) * x)
elif t == 1 and n >= x or x == 1:
	print(n * (x + t))
elif t == 1 and n < x:
	print(x * (n + t))
else:
	print(n * t * x)


a = int(input())
b = int(input())
c = int(input())
ex1 = a * b * c
ex2 = a + b + c
ex3 = a * (b + c)
ex4 = (a + b) * c
print(max(ex1, ex2, ex3, ex4))


(a, b, c) = [int(input()) for x in range(3)]
result = max([a + b + c, a * b * c, a + b * c, a * b + c, (a + b) * c, a * (b + c)])
print(result)


a = int(input())
b = int(input())
c = int(input())
max = a * b * c
if a * (b + c) < (a + b) * c:
	if max < (a + b) * c:
		max = (a + b) * c
elif a * (b + c) > max:
	max = a * (b + c)
if max < a + b + c:
	max = a + b + c
print(max)


a = int(input())
b = int(input())
c = int(input())
list1 = [b + c + a, (b + c) * a, b * c + a, b * c * a, a + b + c, (a + b) * c, a * b + c, a * b * c]
max = 0
for i in range(8):
	if list1[i] >= max:
		max = list1[i]
print(max)


x = int(input())
y = int(input())
z = int(input())
l = []
a = (x + y) * z
b = x * (y + z)
c = x * y * z
d = x + y + z
l.append(a)
l.append(b)
l.append(c)
l.append(d)
print(max(l))


import os
import sys
from io import BytesIO, IOBase

def solution(a, b, c):
	res = a + b + c
	res = max(res, a * b * c)
	res = max(res, a * (b + c))
	res = max(res, (a + b) * c)
	write(res)

def main():
	a = r_int()
	b = r_int()
	c = r_int()
	solution(a, b, c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


a = int(input())
b = int(input())
c = int(input())
list = []
exp1 = a + b * c
list.append(exp1)
exp2 = a * (b + c)
list.append(exp2)
exp3 = a * b * c
list.append(exp3)
exp4 = (a + b) * c
list.append(exp4)
exp5 = a + b + c
list.append(exp5)
list.sort()
print(list[4])


n = 3
a = []
for _ in range(0, n):
	ele = int(input())
	a.append(ele)
operations_list = []
operations_list.append(a[0] + a[1] * a[2])
operations_list.append(a[0] * (a[1] + a[2]))
operations_list.append(a[0] * a[1] * a[2])
operations_list.append((a[0] + a[1]) * a[2])
operations_list.append(a[0] + a[1] + a[2])
operations_list.append(a[0] * a[1] + a[2])
print(max(operations_list))


a = int(input())
b = int(input())
c = int(input())
d1 = int(a + b + c)
d2 = int(a * b + c)
d3 = int(a + b * c)
d4 = int((a + b) * c)
d5 = int(a * (b + c))
d6 = int(a * b * c)
print(max(d1, d2, d3, d4, d5, d6))


a = int(input())
bt = 0
b = int(input())
c = int(input())
d = [a + b * c, a * b + c, (a + b) * c, a * (b + c), a * b * c, a + b + c]
for i in range(6):
	if d[i] > bt:
		bt = d[i]
print(bt)


a = int(input())
b = int(input())
c = int(input())
x = []
s = a + b + c
x.append(s)
s2 = a + b * c
x.append(s2)
s3 = (a + b) * c
x.append(s3)
s4 = a * b + c
x.append(s4)
s5 = a * (b + c)
x.append(s5)
s6 = a * b * c
x.append(s6)
print(max(x))


(a, b, c) = map(int, [input(), input(), input()])
l = [a * b * c, (a + b) * c, a * (b + c), a + b + c]
print(max(l))


def Expression(a, b, c):
	res = []
	res.append(a * b * c)
	res.append(a * (b + c))
	res.append(a + b * c)
	res.append(a + b + c)
	res.append(a * b + c)
	res.append(a * (b + c))
	res.append((a + b) * c)
	res.append(a + b + c)
	return max(res)
a = int(input())
b = int(input())
c = int(input())
print(Expression(a, b, c))


def expr(aa, bb, op):
	if op:
		return aa + bb
	else:
		return aa * bb
a = int(input())
b = int(input())
c = int(input())
mx = 0
i = 0
while i < 2:
	j = 0
	while j < 2:
		k = 0
		while k < 2:
			if k == 0:
				tmp = expr(expr(a, b, i), c, j)
			else:
				tmp = expr(a, expr(b, c, i), j)
			if tmp > mx:
				mx = tmp
			k = k + 1
		j = j + 1
	i = i + 1
print(mx)


l = []
for i in range(3):
	l.append(int(input()))
s = sum(l)
a = (l[0] + l[1]) * l[2]
b = l[0] * (l[1] + l[2])
c = l[0] * l[1] * l[2]
print(max(a, b, c, s))


def max_ex(a, b, c):
	ex1 = a + b * c
	ex2 = a * b + c
	ex3 = a + b + c
	ex4 = a * b * c
	ex5 = (a + b) * c
	ex6 = a + b * c
	ex7 = a * (b + c)
	max_possible = max(ex1, ex2, ex3, ex3, ex4, ex5, ex6, ex7)
	return max_possible
a = int(input())
b = int(input())
c = int(input())
print(max_ex(a, b, c))


inx = lambda : int(input())
(a, b, c) = (inx(), inx(), inx())
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


from sys import stdin

def opera(a, b, c):
	g = 0
	r = a * b + c
	if r > g:
		g = r
	r = a * (b + c)
	if r > g:
		g = r
	r = a + b * c
	if r > g:
		g = r
	r = (a + b) * c
	if r > g:
		g = r
	r = a * b * c
	if r > g:
		g = r
	r = a + b + c
	if r > g:
		g = r
	return g

def main():
	a = int(stdin.readline().strip())
	b = int(stdin.readline().strip())
	c = int(stdin.readline().strip())
	print(opera(a, b, c))
main()


a = int(input())
b = int(input())
c = int(input())
arr = []
result1 = a + b * c
arr.append(result1)
result2 = a * (b + c)
arr.append(result2)
result3 = a * b * c
arr.append(result3)
result4 = (a + b) * c
arr.append(result4)
result5 = a + b + c
arr.append(result5)
print(max(arr))


(a, b, c) = map(int, [input() for x in range(3)])
m = 0
m = max(m, a + b + c)
m = max(m, a * b + c)
m = max(m, a * b * c)
m = max(m, a + b * c)
m = max(m, (a + b) * c)
m = max(m, a * (b + c))
print(m)


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
r = (a + b) * c
f = a * b + c
w = a * (b + c)
l = a * b * c
j = a + b + c
q = max(d, r, f, w, l, j)
print(q)


a = int(input())
b = int(input())
c = int(input())
x = a * b * c
y = a + b + c
z = (a + b) * c
p = a + b * c
r = a * (b + c)
q = a * b + c
print(max(x, y, z, p, q, r))


a = int(input())
b = int(input())
c = int(input())
n1 = a + b + c
n2 = a * c + b * c
n3 = a + b * c
n4 = a * b * c
n5 = a * b + c
n6 = a * b + a * c
t = [n1, n2, n3, n4, n5, n6]
t.sort()
print(t[5])


arr = []
for i in range(3):
	arr.append(int(input()))
(a, b, c) = [x for x in arr]
print(max(a + b + c, a * b * c, (a + b) * c, a * (b + c)))


import math

def ost(a, b):
	if a % b != 0:
		return 1
	return 0
a = int(input())
b = int(input())
c = int(input())
ans = 0
if a + b + c > ans:
	ans = a + b + c
if a * b * c > ans:
	ans = a * b * c
if (a + b) * c > ans:
	ans = (a + b) * c
if a * (c + b) > ans:
	ans = a * (b + c)
if a + b * c > ans:
	ans = a + b * c
if a * b + c > ans:
	ans = a * b + c
print(ans)


def f(a, b, c):
	s = a * b * c
	return s

def d(a, b, c):
	s = (a + b) * c
	return s

def e(a, b, c):
	s = a * (b + c)
	return s

def g(a, b, c):
	s = a + b * c
	return s

def h(a, b, c):
	s = a + b + c
	return s
a = int(input())
b = int(input())
c = int(input())
print(max(f(a, b, c), e(a, b, c), d(a, b, c), g(a, b, c), h(a, b, c)))


num = []
num.append(int(input()))
num.append(int(input()))
num.append(int(input()))
while min(num) == 1:
	m = num.index(1)
	num.pop(m)
	if m >= len(num):
		num[m - 1] += 1
	elif m == 0:
		num[m] += 1
	elif num[m - 1] < num[m]:
		num[m - 1] += 1
	else:
		num[m] += 1
m = 1
for i in range(len(num)):
	m *= num[i]
print(m)


from heapq import heappush, heappop
import queue
import re

def int_raw():
	return int(input())

def ss_raw():
	return input().split()

def ints_raw():
	return list(map(int, ss_raw()))
INF = 1 << 29

def make1d_arr(n, val=INF):
	return [val for i in range(n)]

def make2d_arr(h, w, val=INF):
	return [[val for i in range(w)] for i in range(h)]
abc = [0] * 3
abc[0] = int_raw()
abc[1] = int_raw()
abc[2] = int_raw()

def main(depth, buf, arr):
	if depth == 3:
		return buf
	return max(main(depth + 1, arr[depth] * buf, arr), main(depth + 1, arr[depth] + buf, arr))
print(max(main(1, abc[0], abc), main(1, abc[2], abc[::-1])))


from sys import stdin

def main():
	a = int(stdin.readline())
	b = int(stdin.readline())
	c = int(stdin.readline())
	print(max(a + b * c, a * (b + c), a * b * c, (a + b) * c, a * b + c, a + b + c))
main()


a = int(input())
b = int(input())
c = int(input())
z = a * b * c
n = a + b + c
d = (a + b) * c
k = a * (b + c)
H = [z, n, d, k]
print(max(H))


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = a * (b + c)
f = a * b * c
j = (a + b) * c
h = a + b + c
k = a * b + c
print(max(d, e, f, j, h, k))


def maxexp(a, b, c):
	print(max((a + b) * c, a * (b + c), a + b + c, a * b * c))
a = int(input())
b = int(input())
c = int(input())
maxexp(a, b, c)


a = int(input())
b = int(input())
c = int(input())
l = [(a + b) * c, a * b * c, a + b + c, a * (b + c)]
l.sort()
print(l[-1])


a = input()
a = int(a)
b = input()
b = int(b)
c = input()
c = int(c)
i = a + b + c
j = a * b * c
k = a + b * c
m = a * b + c
n = a * (b + c)
p = c * (a + b)
print(max(i, j, k, m, n, p))


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
if a == 1:
	if c != 1:
		print((a + b) * c)
	else:
		print(a + b + c)
if a != 1 and (c == 1 or b == 1):
	if c != 1:
		print(max((a + b) * c, (b + c) * a))
	else:
		print(a * (b + c))


l = []
for i in range(3):
	l.append(int(input()))
x = l.count(1)
a = l[0]
b = l[1]
c = l[2]
if x == 0:
	print(a * b * c)
elif x == 3:
	print(3)
elif x == 1:
	if a == 1:
		print((a + b) * c)
	elif b == 1:
		print(max((b + c) * a, (a + b) * c))
	else:
		print((b + c) * a)
elif x == 2:
	if a == 1 and b == 1:
		print(2 * c)
	elif b == 1 and c == 1:
		print(2 * a)
	else:
		print(b + 2)


a = int(input())
b = int(input())
c = int(input())

def operation1(a, b, c):
	return a * b + c

def operation2(a, b, c):
	return a * (b + c)

def operation3(a, b, c):
	return a + b * c

def operation4(a, b, c):
	return (a + b) * c

def operation5(a, b, c):
	return a * b * c

def operation6(a, b, c):
	return a + b + c
possibilities = [operation1(a, b, c), operation2(a, b, c), operation3(a, b, c), operation4(a, b, c), operation5(a, b, c), operation6(a, b, c)]
print(max(possibilities))


list = []
list2 = []
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list2.append(list[0] + list[1] + list[2])
list2.append((list[0] + list[1]) * list[2])
list2.append(list[0] * (list[1] + list[2]))
list2.append(list[0] * list[1] * list[2])
list2.sort()
print(list2[3])


a = int(input())
b = int(input())
c = int(input())
possible = []
possible.append(a + b + c)
possible.append(a + b * c)
possible.append((a + b) * c)
possible.append(a * (b + c))
possible.append(a * b + c)
possible.append(a * b * c)
print(max(possible))


a = int(input())
b = int(input())
c = int(input())
if a == 1 or b == 1 or c == 1:
	x = []
	t1 = a + b * c
	x.append(t1)
	t2 = a * (b + c)
	x.append(t2)
	t3 = (a + b) * c
	x.append(t3)
	t4 = a + b + c
	x.append(t4)
	x.sort()
	print(x[3])
else:
	print(a * b * c)


import sys
x = int(sys.stdin.readline().rstrip())
y = int(sys.stdin.readline().rstrip())
z = int(sys.stdin.readline().rstrip())
greatestNumber = 0
number = x * y * z
if number > greatestNumber:
	greatestNumber = number
number = x + y * z
if number > greatestNumber:
	greatestNumber = number
number = (x + y) * z
if number > greatestNumber:
	greatestNumber = number
number = x * (y + z)
if number > greatestNumber:
	greatestNumber = number
number = x + y + z
if number > greatestNumber:
	greatestNumber = number
number = x * z + y
if number > greatestNumber:
	greatestNumber = number
print(greatestNumber)


try:
	a = int(input())
	b = int(input())
	c = int(input())
	d = a + b * c
	e = a + b + c
	f = a * b * c
	g = (a + b) * c
	h = a * (b + c)
	l = []
	l.append(d)
	l.append(e)
	l.append(f)
	l.append(g)
	l.append(h)
	l.sort()
	max = l[4]
	print(max)
except:
	pass


l = []
for i in range(3):
	l.append(int(input()))
f = l[0] * (l[1] + l[2])
s = (l[0] + l[1]) * l[2]
t = l[0] * l[1] + l[2]
ft = l[0] + l[1] * l[2]
fv = l[0] + l[1] + l[2]
sx = l[0] * l[1] * l[2]
ans = max(f, s, t, ft, fv, sx)
print(ans)


a = int(input())
b = int(input())
c = int(input())
answer = a * b * c
temp = a + b * c
if temp > answer:
	answer = temp
temp = a * (b + c)
if temp > answer:
	answer = temp
temp = (a + b) * c
if temp > answer:
	answer = temp
temp = a * b + c
if temp > answer:
	answer = temp
temp = a + b + c
if temp > answer:
	answer = temp
print(answer)


(q, w, e) = (int(input()), int(input()), int(input()))
print(max(q + w + e, q + w * e, q * w + e, (q + w) * e, q * (w + e), q * w * e))


a = int(input())
b = int(input())
c = int(input())
p = a + b * c
q = a * (b + c)
r = a * b * c
t = (a + b) * c
s = a + b + c
if p > q and p > r and (p > t) and (p > s):
	print(p)
elif q > r and q > t and (q > s):
	print(q)
elif r > t and r > s:
	print(r)
elif t > s:
	print(t)
else:
	print(s)


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
w = (a + b) * c
d = a + b + c
print(max(x, y, z, w, d))


n1 = int(input())
n2 = int(input())
n3 = int(input())
maxv = 0
maxv = max((n1 + n2) * n3, n1 * (n2 + n3))
maxv = max(maxv, n1 + n2 + n3)
maxv = max(maxv, n1 * n2 * n3)
print(maxv)


a = int(input())
b = int(input())
c = int(input())
cs = list()
cs.append(a + b * c)
cs.append(a * (b + c))
cs.append(a * b * c)
cs.append((a + b) * c)
cs.append(a * b + c)
cs.append(a + b + c)
print(max(cs))


(a, b, c) = [int(input()) for i in ' ' * 3]
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


a = int(input())
b = int(input())
c = int(input())
apb = a + b
bpc = b + c
ab = a * b
bs = b * c
apbpc = a + b + c
abc = a * b * c
print(max(apb * c, bpc * a, ab + c, bs + a, apbpc, abc))


a = int(input())
b = int(input())
c = int(input())
d = [a, b, c]
if a == 1 and b == 1 and (c == 1):
	print(3)
elif a + c == 2:
	print(a + b + c)
elif a + b == 2:
	print((a + b) * c)
elif b + c == 2:
	print(a * (b + c))
else:
	for i in d:
		if i == 1:
			print(max((a + b) * c, a * (b + c)))
			break
	else:
		print(a * b * c)


i = 3
a = []
while i > 0:
	c = int(input())
	a.append(c)
	i = i - 1
if a.count(1) > 2:
	exit(print(sum(a)))
if a.count(1) < 1:
	exit(print(a[0] * a[1] * a[2]))
if a[0] == 1:
	exit(print(max((a[0] + a[1]) * a[2], a[0] + a[1] * a[2], sum(a))))
if a[1] == 1:
	exit(print(max((a[1] + a[0]) * a[2], (a[1] + a[2]) * a[0])))
if a[2] == 1:
	exit(print(max((a[2] + a[1]) * a[0], a[2] + a[1] * a[0], sum(a))))


a = int(input())
b = int(input())
c = int(input())
v = []
v.append(a + b + c)
v.append(a * b * c)
v.append(a + b * c)
v.append(a * b + c)
v.append((a + b) * c)
v.append(a * (b + c))
v.sort()
print(v[-1])


a = input()
b = input()
c = input()
d = [a + '+' + b + '+' + c, a + '*' + b + '*' + c, a + '+' + b + '*' + c, '(' + a + '+' + b + ')*' + c, a + '*' + b + '+' + c, a + '*(' + b + '+' + c + ')']
print(max([eval(i) for i in d]))


a = int(input())
b = int(input())
c = int(input())
d = a + b + c
e = a * b + c
f = a + b * c
g = a * b * c
h = (a + b) * c
i = a * (b + c)
j = [d, e, f, g, h, i]
j.sort(reverse=True)
print(j[0])


a = input()
b = input()
c = input()
str1 = a + '+' + b + '+' + c
str2 = a + '+' + b + '*' + c
str3 = a + '*' + b + '*' + c
str4 = a + '*' + b + '+' + c
str5 = '(' + a + '+' + b + ')' + '*' + c
str6 = a + '*' + '(' + b + '+' + c + ')'
A = eval(str1)
B = eval(str2)
C = eval(str3)
D = eval(str4)
E = eval(str5)
F = eval(str6)
print(max(A, B, C, D, E, F))


a = int(input())
b = int(input())
c = int(input())
s = [0 for i in range(6)]
s[0] = a + b + c
s[1] = a * b * c
s[2] = a + b * c
s[3] = a * b + c
s[4] = (a + b) * c
s[5] = a * (b + c)
print(max(s))


import sys
import math
import bisect

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	A = []
	A.append('({0}+{1})+{2}'.format(a, b, c))
	A.append('({0}+{1})*{2}'.format(a, b, c))
	A.append('({0}*{1})+{2}'.format(a, b, c))
	A.append('({0}*{1})*{2}'.format(a, b, c))
	A.append('{0}+({1}+{2})'.format(a, b, c))
	A.append('{0}+({1}*{2})'.format(a, b, c))
	A.append('{0}*({1}+{2})'.format(a, b, c))
	A.append('{0}*({1}*{2})'.format(a, b, c))
	max_val = -10 ** 18
	for a in A:
		val = eval(a)
		max_val = max(max_val, val)
	print(max_val)
main()


a = int(input())
b = int(input())
c = int(input())
_max = a + b + c
if a * b * c > _max:
	_max = a * b * c
if (a + b) * c > _max:
	_max = (a + b) * c
if a * (b + c) > _max:
	_max = a * (b + c)
if a + b * c > _max:
	_max = a + b * c
print(_max)


a = int(input())
b = int(input())
c = int(input())
ex1 = a + b * c
ex2 = a * (b + c)
ex3 = a * b * c
ex4 = (a + b) * c
ex5 = a * b + c
ex6 = a * (b + c)
ex7 = a + b + c
lis = [ex1, ex2, ex3, ex4, ex5, ex6, ex7]
print(max(lis))


nums = []
for i in range(3):
	nums.append(int(input()))
a = nums[0]
b = nums[1]
c = nums[2]
r1 = a + b + c
r2 = a + b * c
r3 = a * b + c
r4 = a * b * c
r5 = (a + b) * c
r6 = a * (b + c)
res = [r1, r2, r3, r4, r5, r6]
print(max(res))


a = int(input())
b = int(input())
c = int(input())
result = 0
if a == 1 or b == 1 or c == 1:
	if a == 1 and b == 1 and (c == 1):
		result = a + b + c
	elif a == 1 and b == 1:
		result = c * 2
	elif b == 1 and c == 1:
		result = a * 2
	elif a == 1 and c == 1:
		result = b + 2
	elif a == 1:
		result = (a + b) * c
	elif b == 1:
		if a < c:
			result = (a + b) * c
		else:
			result = a * (b + c)
	elif c == 1:
		result = a * (b + c)
else:
	result = a * b * c
print(result)


n = int(input())
k = int(input())
m = int(input())
l = max(n + k + m, n * (k + m), (n + k) * m, n * k * m)
print(l)


a = int(input())
b = int(input())
c = int(input())
ch1 = a + b + c
ch2 = (a + b) * c
ch3 = a * (b + c)
ch4 = a * b * c
ch5 = a + b * c
ch6 = a * b + c
print(max(ch1, ch2, ch3, ch4, ch5, ch6))


a = 0
b = 0
c = 0
a = int(input())
b = int(input())
c = int(input())
r_list = [a + b + c, a + b * c, a * b + c, a * (b + c), (a + b) * c, a * b * c]
r_list.sort()
highest = r_list.pop()
print(highest)


def solve(a, b, c):
	ans = 0
	ans = max(ans, a + b + c)
	ans = max(ans, (a + b) * c)
	ans = max(ans, a * b * c)
	ans = max(ans, a * (b + c))
	return ans
a = int(input())
b = int(input())
c = int(input())
print(solve(a, b, c))


a = int(input())
s = int(input())
d = int(input())
print(max(a + s + d, a * s * d, a + s * d, a * s + d, (a + s) * d, a * (s + d)))


a = int(input())
b = int(input())
c = int(input())
answer_1 = a + b * c
answer_2 = a * (b + c)
answer_3 = a * b * c
answer_4 = (a + b) * c
answer_5 = a + b + c
print(max(answer_1, answer_2, answer_3, answer_4, answer_5))


def mayor(a, b):
	if a >= b:
		x = a
	else:
		x = b
	return x
a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = a * (b + c)
f = a * b * c
g = (a + b) * c
h = a + b + c
m = mayor(mayor(d, e), mayor(f, g))
n = mayor(m, h)
print(n)


a = int(input())
b = int(input())
c = int(input())
maxim = a + b + c
if a + b * c > maxim:
	maxim = a + b * c
if a * b + c > maxim:
	maxim = a * b + c
if (a + b) * c > maxim:
	maxim = (a + b) * c
if a * (b + c) > maxim:
	maxim = a * (b + c)
if a * b * c > maxim:
	maxim = a * b * c
print(maxim)


a = int(input())
b = int(input())
c = int(input())
s = a + b * c
s2 = a * (b + c)
s3 = a * b * c
s4 = (a + b) * c
s5 = a + b + c
print(max(s, s2, s3, s4, s5))


a = int(input())
b = int(input())
c = int(input())
w = a + b * c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
aa = a + b + c
print(max(w, max(x, max(y, max(z, aa)))))


angka = [0 for i in range(3)]
for i in range(3):
	angka[i] = int(input())
hasil = [0 for i in range(6)]
hasil[0] = angka[0] + angka[1] * angka[2]
hasil[1] = angka[0] * (angka[1] + angka[2])
hasil[2] = angka[0] * angka[1] * angka[2]
hasil[3] = (angka[0] + angka[1]) * angka[2]
hasil[4] = angka[0] + angka[1] + angka[2]
hasil[5] = angka[0] * angka[1] + angka[2]
max = 0
for i in range(6):
	if max < hasil[i]:
		max = hasil[i]
print(max)


(a, b, c) = [int(input()) for _ in '123']
print(max(a + b + c, (a + b) * c, a * (b + c), a * b * c))


a = int(input())
b = int(input())
c = int(input())
f = 0
for i in range(2):
	if i == 1:
		d = max(a + b, a * b)
		e = max(d + c, d * c)
	else:
		d = max(b + c, b * c)
		e = max(a + d, a * d)
	f = max(f, e)
print(f)


x = []
x.append(int(input()))
x.append(int(input()))
x.append(int(input()))
if 1 in x:
	c = x.count(1)
	if c == 3:
		a = 3
	elif c == 2:
		i = x.index(max(x))
		if i == 1:
			a = sum(x)
		else:
			a = x[i] * 2
	elif x[0] == 1:
		a = (x[0] + x[1]) * x[2]
	elif x[2] == 1:
		a = x[0] * (x[1] + x[2])
	else:
		minn = min(x[0], x[2])
		maxx = max(x[0], x[2])
		a = (x[1] + minn) * maxx
else:
	a = x[0] * x[1] * x[2]
print(a)


a = int(input())
b = int(input())
c = int(input())
d = []
d.append(a)
d.append(b)
d.append(c)
s = 0
i = 0
if d[i] == 1:
	if i != 0:
		if d[i - 1] > d[i + 1]:
			s = (d[i] + d[i + 1]) * d[i - 1]
		else:
			s = (d[i] + d[i - 1]) * d[i + 1]
	elif d[i + 1] == 1:
		if d[i + 2] != 1:
			s = (d[i] + d[i + 1]) * d[i + 2]
		else:
			s = d[i] + d[i + 1] + d[i + 2]
	elif d[i + 2] == 1:
		s = d[i] + d[i + 1] + d[i + 2]
	else:
		s = (d[i] + d[i + 1]) * d[i + 2]
elif d[i + 1] == 1:
	if d[i + 2] == 1:
		s = (d[i + 1] + d[i + 2]) * d[i]
	elif d[i] < d[i + 2]:
		s = (d[i] + d[i + 1]) * d[i + 2]
	else:
		s = (d[i + 2] + d[i + 1]) * d[i]
elif d[i + 2] == 1:
	s = (d[i + 1] + d[i + 2]) * d[i]
else:
	s = d[i] * d[i + 1] * d[i + 2]
print(s)


a = int(input())
b = int(input())
c = int(input())
M = 0
M = max(M, a + b * c)
M = max(M, a * (b + c))
M = max(M, a * b * c)
M = max(M, (a + b) * c)
M = max(M, a + b + c)
print(M)


(a, b, c) = [int(input()) for i in ' ' * 3]
k1 = a + b + c
k2 = a * (b + c)
k3 = (a + b) * c
k4 = a * b * c
print(max(k1, k2, k3, k4))


a = int(input())
b = int(input())
c = int(input())
op1 = (a + b) * c
op2 = a * b + c
op3 = a + b * c
op4 = a * b * c
op5 = a + b + c
op6 = a * (b + c)
print(max(op6, max(op1, max(max(op2, op3), max(op4, op5)))))


a = int(input())
b = int(input())
c = int(input())
x = 0
str = []
str.append(a + b * c)
str.append(a * b + c)
str.append(a * (b + c))
str.append((a + b) * c)
str.append(a + b + c)
str.append(a * b * c)
for i in str:
	if x < i:
		x = i
print(x)


import math
a = int(input())
b = int(input())
c = int(input())
print(max(a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c, a * b + c))


a = int(input())
b = int(input())
c = int(input())
r1 = a + b + c
r2 = a * b + c
r3 = a + b * c
r4 = a * b * c
r5 = (a + b) * c
r6 = a * (b + c)
result = max(r1, r2, r3, r4, r5, r6)
print(result)


a = input()
b = input()
c = input()
(a, b, c) = map(int, [a, b, c])
ans = a + b + c
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
ans = max(ans, (a + b) * c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
result = []
temp = 0
temp = a * b * c
result.append(temp)
temp = a * b + c
result.append(temp)
temp = a * (b + c)
result.append(temp)
temp = a + b * c
result.append(temp)
temp = (a + b) * c
result.append(temp)
temp = a + b + c
result.append(temp)
print(max(result))


a = int(input())
b = int(input())
c = int(input())
yek = a + b + c
do = (a + b) * c
se = a + b * c
char = a * b + c
panj = a * (b + c)
shsh = a * b * c
if yek >= do and yek >= se and (yek >= char) and (yek >= panj) and (yek >= shsh):
	print(yek)
if do > yek and do >= se and (do >= char) and (do >= panj) and (do >= shsh):
	print(do)
if se > do and se > yek and (se >= char) and (se >= panj) and (se >= shsh):
	print(se)
if char > do and char > se and (char > yek) and (char >= panj) and (char >= shsh):
	print(char)
if panj > do and panj > se and (panj > char) and (panj > yek) and (panj >= shsh):
	print(panj)
if shsh > do and shsh > se and (shsh > char) and (shsh > panj) and (shsh > yek):
	print(shsh)


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
elif a == 1 and b == 1 and (c == 1):
	print(3)
elif a == 1 and b == 1:
	print(2 * c)
elif b == 1 and c == 1:
	print(2 * a)
elif a == 1 and c == 1:
	print(2 + b)
elif a == 1:
	print((1 + b) * c)
elif c == 1:
	print(a * (b + 1))
elif b == 1:
	print((b + min(a, c)) * max(a, c))


a = int(input())
b = int(input())
c = int(input())
s = []
s.append(a + b + c)
s.append(a + b * c)
s.append(a * b + c)
s.append(a * b * c)
s.append((a + b) * c)
s.append(a * (b + c))
s.sort()
print(s[-1])


a = int(input())
b = int(input())
c = int(input())
(temp, res) = (0, 0)
temp = a * b + c
res = max(temp, res)
temp = a * (b + c)
res = max(temp, res)
temp = a + b + c
res = max(temp, res)
temp = a * b * c
res = max(temp, res)
temp = a + b * c
res = max(temp, res)
temp = (a + b) * c
res = max(temp, res)
print(res)


x = int(input())
y = int(input())
z = int(input())
a = x + y * z
b = x * (y + z)
c = x * y * z
d = (x + y) * z
e = x + y + z
if a >= b and a >= c and (a >= d) and (a >= e):
	print(a)
elif b >= a and b >= c and (b >= d) and (b >= e):
	print(b)
elif c >= a and c >= b and (c >= d) and (c >= e):
	print(c)
elif d >= a and d >= b and (d >= c) and (d >= e):
	print(d)
elif e >= a and e >= b and (e >= c) and (e >= d):
	print(e)


a = int(input())
b = int(input())
c = int(input())
max = [a + b + c, a + b * c, (a + b) * c, a * b * c, a * b + c, a * (b + c)]
max.sort()
print(max[-1])


a = [[] for i in range(3)]
k = 0
for i in range(3):
	a[i] = int(input())
	if a[i] == 1:
		k = k + 1
		t = i
if k == 3:
	print(sum(a))
if k == 2:
	if a[1] != 1:
		print(sum(a))
	else:
		print(2 * max(a))
if k == 1:
	if t == 0 or t == 2:
		print(a[2 - t] * (a[1] + 1))
	else:
		print(max(a) * (sum(a) - max(a)))
if k == 0:
	print(a[0] * a[1] * a[2])


a = int(input())
b = int(input())
c = int(input())
d = a * b * c
d1 = a * (b + c)
d2 = (a + b) * c
d3 = a + b + c
print(max(d, d1, d2, d3))


a = int(input())
b = int(input())
c = int(input())
array = []
array.append(a + b * c)
array.append((a + b) * c)
array.append(a + (b + c))
array.append(a * (b * c))
array.append(a * b + c)
array.append(a * (b + c))
print(max(array))


a = int(input())
b = int(input())
c = int(input())
a1 = a + b * c
b1 = a * (b + c)
c1 = a * b * c
d = (a + b) * c
f = a + b + c
i = [a1, b1, c1, d, f]
print(max(i))


a = int(input())
b = int(input())
c = int(input())
k = a + b * c
l = a * (b + c)
m = a * b * c
n = (a + b) * c
j = a + b + c
print(max(k, l, m, n, j))


(data, result) = ([], [])
while len(data) < 3:
	data.append(int(input()))
result.append(data[0] * data[1] * data[2])
result.append((data[1] + min(data[0], data[2])) * max(data[0], data[2]))
result.append(sum(data))
print(max(result))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	print(3)
elif a == 1 and b == 1 and (c != 1):
	print(2 * c)
elif b == 1 and c == 1 and (a != 1):
	print(2 * a)
elif a == 1 and c == 1 and (b != 1):
	print(a + b + c)
elif a == 1 and b != 1 and (c != 1):
	print((a + b) * c)
elif b == 1 and a != 1 and (c != 1):
	if a > c:
		print(a * (b + c))
	elif c > a or c == a:
		print((a + b) * c)
elif c == 1 and a != 1 and (b != 1):
	print(a * (b + c))
elif a != 1 and b != 1 and (c != 1):
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
_sum = a + b + c
if _sum < a * b * c:
	_sum = a * b * c
if _sum < a * (b + c):
	_sum = a * (b + c)
if _sum < (a + b) * c:
	_sum = (a + b) * c
print(_sum)


read = lambda : int(input())
a = read()
b = read()
c = read()
print(max(a + b + c, a * b * c, a * (b + c), a * b + c, (a + b) * c, a + b * c))


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	if b == 1:
		if c == 1:
			Mayor = 3
		else:
			Mayor = (a + b) * c
	elif c == 1:
		Mayor = a + b + c
	else:
		Mayor = (a + b) * c
elif b == 1:
	if c == 1:
		Mayor = a * (b + c)
	elif a < c:
		Mayor = (a + b) * c
	else:
		Mayor = a * (b + c)
elif c == 1:
	Mayor = a * (b + c)
else:
	Mayor = a * b * c
print(Mayor)


a = int(input())
b = int(input())
c = int(input())
values = [a, b, c]
variant_1 = sum(values)
variant_2 = values[0] * values[1] * values[2]
variant_3 = (values[0] + values[1]) * values[2]
variant_4 = values[0] * (values[1] + values[2])
print(max(variant_1, variant_2, variant_3, variant_4))


a = 3 * [0]
for i in range(3):
	a[i] = int(input())
print(max(a[0] + a[1] + a[2], a[0] * a[1] + a[2], a[0] * a[1] * a[2], a[0] + a[1] * a[2], (a[0] + a[1]) * a[2], a[0] * (a[1] + a[2])))


from sys import stdin
l = []
for i in range(3):
	l.append(int(stdin.readline().rstrip()))
(a, b, c) = (l[0], l[1], l[2])
k = [0, 0, 0, 0]
k[0] = a + b + c
k[1] = a * b * c
k[2] = (a + b) * c
k[3] = a * (b + c)
print(max(k))


a = int(input())
b = int(input())
c = int(input())
var = 5
maxi = 0
mezi = 0
for i in range(var):
	if i == 0:
		mezi = a + b * c
	if i == 1:
		mezi = a * (b + c)
	if i == 2:
		mezi = a * b * c
	if i == 3:
		mezi = (a + b) * c
	if i == 4:
		mezi = a + b + c
	if mezi > maxi:
		maxi = mezi
print(maxi)


i = lambda : int(input())
(a, b, c) = (i(), i(), i())
z = [1, 2, 3, 4]
z[0] = a * b * c
z[1] = (a + b) * c
z[2] = a * (b + c)
z[3] = a + b + c
print(max(z))


def f(s):
	if isinstance(s, int):
		return s
	op = s[0]
	a = f(s[1])
	b = f(s[2])
	if op == '*':
		return a * b
	else:
		return a + b

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	ans = 0
	for s1 in ['+', '*']:
		for s2 in ['+', '*']:
			for brack in [0, 1, 2]:
				cur = 0
				if brack == 0:
					cur = f((s2, c, (s1, a, b)))
				elif brack == 1:
					cur = f((s1, a, (s2, b, c)))
				elif s1 == '*':
					cur = f((s2, (s1, a, b), c))
				else:
					cur = f((s1, (s2, b, c), a))
				ans = max(ans, cur)
	return ans
print(main())


import operator
import itertools

def fold(fs, xs):
	acc = xs[0]
	assert len(fs) + 1 == len(xs)
	for (x, f) in zip(xs[1:], fs):
		acc = f(acc, x)
	return acc

def solve(a, b, c):
	orders = [(a, b, c), (b, c, a)]
	operators = itertools.combinations_with_replacement([operator.add, operator.mul], 2)
	return max((fold(ops, args) for ops in operators for args in orders))

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	result = solve(a, b, c)
	print(result)
main()


a = []
for i in range(3):
	a.append(int(input()))
if a[0] == 1:
	print(max(sum(a), (a[0] + a[1]) * a[2]))
elif a[1] == 1:
	print(max(sum(a), max((a[0] + a[1]) * a[2], (a[1] + a[2]) * a[0])))
elif a[2] == 1:
	print(max(sum(a), (a[1] + a[2]) * a[0]))
else:
	print(max(sum(a), a[0] * a[1] * a[2]))


a = int(input())
b = int(input())
c = int(input())
li = []
li.append(a * b * c)
li.append(a + b + c)
li.append(a * (b + c))
li.append(a * b + c)
li.append((a + b) * c)
li.append(a + b * c)
print(max(li))


a = int(input())
b = int(input())
c = int(input())
one = list()
d = a + b * c
one.append(int(d))
e = a * (b + c)
one.append(int(e))
f = a * b * c
one.append(int(f))
g = (a + b) * c
one.append(int(g))
h = a + b + c
one.append(int(h))
i = a * b + c
one.append(int(i))
print(max(one))


a = int(input())
b = int(input())
c = int(input())
no1 = a * b * c
no2 = a + b + c
no3 = (a + b) * c
no4 = a * (b + c)
no5 = a + b * c
no6 = a * b + c
maxno = max(no1, no2, no3, no4, no5, no6)
print(maxno)


a = int(input())
b = int(input())
c = int(input())
mx = 0
if a == 1 and b == 1 and (c == 1):
	mx = 3
elif a == 1 or b == 1 or c == 1:
	if a == 1:
		mx = max((a + b) * c, a + b + c)
	elif b == 1:
		m = min(a, c)
		if m == a:
			mx = max((a + b) * c, a + b + c)
		elif m == c:
			mx = max(a * (b + c), a + b + c)
	elif c == 1:
		mx = max(a * (b + c), a + b + c)
else:
	mx = max(a * b * c, a + b + c)
print(mx)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
l.sort()
if a > 1 and b > 1 and (c > 1):
	print(a * b * c)
elif a == 1 and b >= 1 and (c > 1):
	print((a + b) * c)
elif a > 1 and b == 1 and (c > 1):
	print((min(a, c) + b) * max(a, c))
elif a > 1 and b >= 1 and (c == 1):
	print(a * (b + c))
elif a == 1 and b == 1 and (c == 1):
	print(3)
else:
	print(a + b + c)


a = int(input())
b = int(input())
c = int(input())
ans0 = a + b + c
ans1 = (a + b) * c
ans2 = a * (b + c)
ans3 = a * b * c
print(max(ans0, ans1, ans2, ans3))


abc = []
for i in range(3):
	abc.append(int(input()))
(a, b, c) = abc
if a == b == c == 1:
	print(3)
elif 1 not in abc:
	print(a * b * c)
elif abc.count(1) == 2:
	if a == b == 1:
		print((a + b) * c)
	elif b == c == 1:
		print(a * (b + c))
	elif a == c == 1:
		print(a + b + c)
elif a == 1:
	print((a + b) * c)
elif c == 1:
	print(a * (b + c))
elif b == 1:
	print((b + min(a, c)) * max(a, c))


a = int(input())
b = int(input())
c = int(input())
mx = 0
if a + b + c > mx:
	mx = a + b + c
if a * b * c > mx:
	mx = a * b * c
if a + b * c > mx:
	mx = a + b * c
if (a + b) * c > mx:
	mx = (a + b) * c
if a * b + c > mx:
	mx = a * b + c
if a * (b + c) > mx:
	mx = a * (b + c)
print(mx)


from sys import *
input = stdin.readline
l = []
a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = (a + b) * c
z = a * b * c
d = a * (b + c)
print(max(x, y, z, d))


a = int(input())
b = int(input())
c = int(input())
x1 = a + b + c
x2 = (a + b) * c
x3 = a * (b + c)
x4 = a * b * c
print(max(x1, x2, x3, x4))


x = int(input())
y = int(input())
z = int(input())
e1 = x + y * z
e2 = x * (y + z)
e3 = x * y * z
e4 = (x + y) * z
e5 = x + y + z
print(max(e1, e2, e3, e4, e5))


a = int(input())
b = int(input())
c = int(input())
m1 = a + b + c
m2 = a * b * c
m3 = a + b * c
m4 = a * b + c
m5 = (a + b) * c
m6 = a * (b + c)
print(max(m1, m2, m3, m4, m5, m6))


a = int(input())
b = int(input())
c = int(input())
A = a + b * c
B = a * (b + c)
C = a * b * c
D = (a + b) * c
E = a + b + c
list = [A, B, C, D, E]
large = max(list)
print(large)


a = int(input())
b = int(input())
c = int(input())
M = 0
if a + b + c > M:
	M = a + b + c
if a + b * c > M:
	M = a + b * c
if a * b + c > M:
	M = a * b + c
if a * b * c > M:
	M = a * b * c
if (a + b) * c > M:
	M = (a + b) * c
if a * (b + c) > M:
	M = a * (b + c)
print(M)


a = int(input())
b = int(input())
c = int(input())
d = a * b * c
e = a + b + c
f = a * b + c
g = a + b * c
h = (a + b) * c
i = a * (b + c)
for k in range(1000, 1, -1):
	if d == k:
		print(k)
		break
	elif e == k:
		print(k)
		break
	elif f == k:
		print(k)
		break
	elif g == k:
		print(k)
		break
	elif h == k:
		print(k)
		break
	elif i == k:
		print(k)
		break
	else:
		continue


a = int(input())
b = int(input())
c = int(input())
(res, r) = (0, 0)
for i in range(6):
	if i == 0:
		r = a + b * c
		if r > res:
			res = r
	elif i == 1:
		r = (a + b) * c
		if r > res:
			res = r
	elif i == 2:
		r = a + b + c
		if r > res:
			res = r
	elif i == 3:
		r = a * b + c
		if r > res:
			res = r
	elif i == 4:
		r = a * (b + c)
		if r > res:
			res = r
	elif i == 5:
		r = a * b * c
		if r > res:
			res = r
print(res)


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
if a == 1:
	if b == 1:
		if c == 1:
			print('3')
		else:
			print(2 * c)
	elif c == 1:
		print(b + 2)
	else:
		print((b + 1) * c)
elif b == 1:
	if c == 1:
		print(2 * a)
	else:
		print((min(a, c) + 1) * max(a, c))
elif c == 1:
	print(a * (b + 1))
else:
	print(a * b * c)


numbers = []
adding = 0
multiply = 1
result = 0
for i in range(3):
	temp = int(input())
	adding += temp
	multiply *= temp
	numbers.append(temp)
if adding > multiply:
	result = adding
else:
	result = multiply
result1 = (numbers[0] + numbers[1]) * numbers[2]
result2 = numbers[0] * (numbers[1] + numbers[2])
if result1 > result:
	result = result1
if result2 > result:
	result = result2
print(result)


a = int(input())
b = int(input())
c = int(input())
w = (a + b) * c
x = a * b + c
y = a + b + c
z = a * b * c
i = a + b * c
j = a * (b + c)
k = a + b + c
l = a * b * c
o = max(i, j)
p = max(k, i)
q = max(o, p)
m = max(w, x)
n = max(y, z)
r = max(m, n)
print(max(q, r))


a = int(input())
b = int(input())
c = int(input())
answer = []
caseOne = a + b * c
answer.append(caseOne)
caseTwo = a * (b + c)
answer.append(caseTwo)
caseThree = a * b * c
answer.append(caseThree)
caseFour = (a + b) * c
answer.append(caseFour)
caseFive = a + b + c
answer.append(caseFive)
answerSorted = sorted(answer)
print(answerSorted[4])


a = int(input())
b = int(input())
c = int(input())
z1 = a + b + c
z2 = a * b * c
z3 = a + b * c
z4 = a * b + c
z5 = (a + b) * c
z6 = a * (b + c)
print(max(z1, z2, z3, z4, z5, z6))


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * b * c
z = a * (b + c)
v = (a + b) * c
s = a + b + c
h = a * b + c
l = [x, y, z, v, s, h]
print(max(l))


a = int(input())
b = int(input())
c = int(input())
m = [0] * 8
m[0] = a + b + c
m[1] = (a + b) * c
m[2] = a * b + c
m[3] = a * b * c
m[4] = a + (b + c)
m[5] = a + b * c
m[6] = a * (b + c)
m[7] = a * (b * c)
print(max(m))


lista = []
a = int(input())
b = int(input())
c = int(input())
v1 = a * b * c
v2 = a * (b + c)
v3 = (a + b) * c
v4 = a + b + c
print(max(v1, v2, v3, v4))


a = int(input())
b = int(input())
c = int(input())
maxn = 0
maxn = max(maxn, a + b + c)
maxn = max(maxn, a + (b + c))
maxn = max(maxn, a * b + c)
maxn = max(maxn, a * (b + c))
maxn = max(maxn, (a + b) * c)
maxn = max(maxn, a + b * c)
maxn = max(maxn, a * b * c)
maxn = max(maxn, a * (b * c))
print(maxn)


(a, b, c) = (int(input()), int(input()), int(input()))
d = a + b + c
r = a + b * c
e = a * b * c
t = a * (b + c)
w = (a + b) * c
ma = max(d, r, e, t, w)
print(ma)


a = int(input())
b = int(input())
c = int(input())
l = []
s1 = a + b * c
l.append(s1)
s2 = a * (b + c)
l.append(s2)
s3 = a * b * c
l.append(s3)
s4 = (a + b) * c
l.append(s4)
if max(l) < a + b + c:
	print(a + b + c)
else:
	print(max(l))


a = int(input())
b = int(input())
c = int(input())
max_ = []
for i in range(5):
	if i == 0:
		max_.append(a + b + c)
	elif i == 1:
		max_.append((a + b) * c)
	elif i == 2:
		max_.append(a * (b + c))
	elif i == 3:
		max_.append(a * b * c)
	elif i == 4:
		max_.append(a * b + c)
	elif i == 5:
		max_.append(a + b * c)
print(max(max_))


a = int(input())
b = int(input())
c = int(input())
a1 = a * b * c
if a1 < a * (b + c):
	a1 = a * (b + c)
if a1 < (a + b) * c:
	a1 = (a + b) * c
if a1 < a + b + c:
	a1 = a + b + c
print(a1)


a = int(input())
b = int(input())
c = int(input())
first = 0
if a + b > b + c:
	first = a * (b + c)
elif a + b < b + c:
	first = (a + b) * c
elif a + b == b + c:
	first = a * (b + c)
second = a * b * c
third = a + b + c
word = max(first, second, third)
print(word)


n = int(input())
m = int(input())
k = int(input())
if (n + m) * k >= (m + k) * n and (n + m) * k > n * m * k and ((n + m) * k > n + m + k):
	print((n + m) * k)
elif (m + k) * n > (n + m) * k and (m + k) * n > n * m * k and ((m + k) * n > n + m + k):
	print((m + k) * n)
elif n * m * k < n + m + k:
	print(n + m + k)
else:
	print(n * m * k)


a = int(input())
b = int(input())
c = int(input())

def maxi(a, b):
	if len(a) == 1 and len(b) == 1:
		return max(a[0] * b[0], a[0] + b[0])
	elif len(a) == 1:
		return max(a[0] * maxi([b[0]], [b[1]]), a[0] + maxi([b[0]], [b[1]]))
	else:
		return max(b[0] * maxi([a[0]], [a[1]]), b[0] + maxi([a[0]], [a[1]]))
print(max(maxi([a, b], [c]), maxi([a], [b, c])))


def summa(*args):
	kol = 0
	for i in range(len(args)):
		kol += args[i]
	return kol

def composition(*args):
	kol = 1
	for i in range(len(args)):
		kol *= args[i]
	return kol
a = int(input())
b = int(input())
c = int(input())
l = summa(a, b, c)
l = max(l, summa(composition(a, b), c))
l = max(l, summa(composition(c, b), a))
l = max(l, composition(a, b, c))
l = max(l, composition(a, summa(b, c)))
l = max(l, composition(summa(a, b), c))
print(l)


a = int(input())
b = int(input())
c = int(input())
x = 1
if a == 1:
	b += 1
	a = 0
if c == 1:
	b += 1
	c = 0
if b == 1:
	if a < c:
		a += 1
	else:
		c += 1
	b == 0
if a != 0:
	x *= a
if b != 0:
	x *= b
if c != 0:
	x *= c
print(x)


n = int(input())
m = int(input())
z = int(input())
print(max(n * m * z, max((n + m) * z, max(n + z + m, (m + z) * n))))


a = int(input())
b = int(input())
c = int(input())
list = []
l1 = a + b + c
l2 = a * b * c
l3 = a + b * c
l4 = a * b + c
l5 = a * (b + c)
l6 = a + b * c
l7 = (a + b) * c
l8 = a * b + c
list.append(l1)
list.append(l2)
list.append(l3)
list.append(l4)
list.append(l5)
list.append(l6)
list.append(l7)
list.append(l8)
m = max(list)
print(m)


(a, b, c) = (int(input()), int(input()), int(input()))
mmm = a + b * c
add = a + b + c
sad = (a + b) * c
mad = a * (b + c)
multi = a * b * c
print(max(mmm, add, sad, mad, multi))


a = int(input())
b = int(input())
c = int(input())
f = [lambda x, y, z: 0 for i in range(6)]
f[0] = lambda x, y, z: x + y + z
f[1] = lambda x, y, z: x + y * z
f[2] = lambda x, y, z: x * y + z
f[3] = lambda x, y, z: x * y * z
f[4] = lambda x, y, z: (x + y) * z
f[5] = lambda x, y, z: x * (y + z)
print(max(f, key=lambda g: g(a, b, c))(a, b, c))


a = int(input())
b = int(input())
c = int(input())
d = [a * b * c, a * (b + c), (a + b) * c, a * b + c, a + b * c, a + b + c]
d.sort()
d.reverse()
print(d[0])


def main():
	num1 = int(input())
	num2 = int(input())
	num3 = int(input())
	res = max(num1 * (num2 + num3), num1 * num2 * num3, (num1 + num2) * num3, num1 + num2 + num3)
	print(res)
main()


a = int(input())
b = int(input())
c = int(input())
maximum = 0
test1 = a + b + c
test2 = a + b * c
test3 = (a + b) * c
test4 = a * b * c
test5 = a * (b + c)
test6 = a * b + c
maximum = max(test1, test2, test3, test4, test5, test6)
print(maximum)


a = int(input())
b = int(input())
c = int(input())
l = [(a + b) * c, (b + c) * a, a * b * c, a + b + c]
max = l[0]
count = 0
while count < len(l):
	i = l[count]
	if i > max:
		max = i
	count += 1
print(max)


a = int(input())
b = int(input())
c = int(input())
max = 0
sum = a + b * c
if sum > max:
	max = sum
sum1 = a * (b + c)
if sum1 > max:
	max = sum1
sum2 = a * b * c
if sum2 > max:
	max = sum2
sum3 = (a + b) * c
if sum3 > max:
	max = sum3
sum4 = a + b + c
if sum4 > max:
	max = sum4
print(max)


a = int(input())
b = int(input())
c = int(input())
d = []
l = a * b * c
d.append(l)
m = a * (b + c)
d.append(m)
n = a + b * c
d.append(n)
o = (a + b) * c
d.append(o)
q = a + b + c
d.append(q)
r = a * b + c
d.append(r)
print(max(d))


a = int(input())
b = int(input())
c = int(input())
output = a
for i in [b, c]:
	output = max(output * i, output + i)
if (b + c) * a > output:
	output = (b + c) * a
if b * c + a > output:
	output = b * c + a
print(output)


a = int(input())
b = int(input())
c = int(input())
s = a + b + c
t = a * b * c
u = a * b + c
d = (a + b) * c
e = a * (b + c)
f = a + b * c
print(max(s, t, u, d, e, f))


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
a = rint()
b = rint()
c = rint()
print(max(a + b + c, (a + b) * c, a * b + c, a * b * c, a + (b + c), a + b * c, a * (b + c), a * (b * c)))


a = int(input())
b = int(input())
c = int(input())
count1 = [a, b, c].count(1)
if count1 == 0:
	print(a * b * c)
if count1 == 1:
	print((min(a, c) + b) * max(a, c))
if count1 == 2:
	if a == b == 1 or b == c == 1:
		print(2 * max(a, b, c))
	if a == c == 1:
		print(a + b + c)
if count1 == 3:
	print('3')


a = int(input())
b = int(input())
c = int(input())

def f0(a, b, c):
	return a + b + c

def f1(a, b, c):
	return a * b * c

def f2(a, b, c):
	return a + b * c

def f3(a, b, c):
	return a * b + c

def f4(a, b, c):
	return (a + b) * c

def f5(a, b, c):
	return a * (b + c)
func_list = [f0, f1, f2, f3, f4, f5]
res_list = []
for f in func_list:
	res_list.append(f(a, b, c))
print(max(res_list))


(x, y, z) = [int(input()) for i in range(3)]
a = x + y + z
b = (x + y) * z
c = x * (y + z)
d = x * y * z
e = x + y * z
f = x * y + z
s = max(a, b, c, d, e, f)
print(s)


l = []
for i in range(3):
	n = int(input())
	l.append(n)
result = []
result.append(l[0] + l[1] + l[2])
result.append(l[0] * l[1] * l[2])
result.append(l[0] * l[1] + l[2])
result.append(l[0] + l[1] * l[2])
result.append((l[0] + l[1]) * l[2])
result.append(l[0] * (l[1] + l[2]))
print(max(result))


def f1(a, b, c):
	return a + b * c

def f2(a, b, c):
	return a * (b + c)

def f3(a, b, c):
	return a * (b * c)

def f4(a, b, c):
	return (a + b) * c

def f5(a, b, c):
	return a + b + c
a = int(input())
b = int(input())
c = int(input())
l = []
l.append(f1(a, b, c))
l.append(f2(a, b, c))
l.append(f3(a, b, c))
l.append(f4(a, b, c))
l.append(f5(a, b, c))
print(max(l))


ls = [int(input()) for _ in range(3)]
(a, b, c) = (ls[0], ls[1], ls[2])
ans = a + b + c
ans = max(ans, a * b * c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
print(ans)


cin = lambda : int(input())
(a, b, c) = (cin(), cin(), cin())
k = a + b + c
l = (a + b) * c
m = a * (b + c)
n = a * b * c
print(max(max(k, l), max(m, n)))


a = int(input())
b = int(input())
c = int(input())
case1 = (a + b) * c
case2 = a * (b + c)
case3 = a * b * c
case4 = a + b + c
biggest = max(case1, case2, case3, case4)
print(biggest)


x = int(input())
y = int(input())
z = int(input())
g = (x + y) * z
h = x + y * z
i = x * (y + z)
j = x * y * z
k = x + y + z
l = []
l.append(g)
l.append(h)
l.append(i)
l.append(j)
l.append(k)
print(max(l))


import math
import os
import random
import re
import sys
a = int(input())
b = int(input())
c = int(input())
d = a + b + c
e = (a + b) * c
f = a * (b + c)
h = a * b * c
array = []
array.append(d)
array.append(e)
array.append(f)
array.append(h)
print(max(array))


a = int(input())
b = int(input())
c = int(input())
A0 = a + b + c
A1 = a + b * c
A2 = a * b + c
A3 = (a + b) * c
A4 = a * (b + c)
A5 = a * b * c
li = [A0, A1, A2, A3, A4, A5]
print(max(li))


a = int(input())
b = int(input())
c = int(input())
count = 0
ans1 = 0
ans2 = 0
ans3 = 0
if a == 1:
	count += 1
if b == 1:
	count += 1
if c == 1:
	count += 1
if count == 0:
	ans3 = a * b * c
if count == 3 or count == 2:
	ans1 = a + b + c
if count == 2 or count == 1:
	if a == 1:
		ans2 = (a + b) * c
	elif b == 1:
		if a < c:
			ans2 = (a + b) * c
		else:
			ans2 = (c + b) * a
	else:
		ans2 = (c + b) * a
m = [ans1, ans2, ans3]
print(max(m))


a = int(input())
b = int(input())
c = int(input())
h = (a + b) * c
i = a * (b + c)
j = a + b * c
k = a * b * c
l = a + b + c
list = [h, i, j, k, l]
print(max(list))


x = int(input())
y = int(input())
z = int(input())
s = []
s.append(x + y + z)
s.append(x * y * z)
s.append((x + y) * z)
s.append(x * (y + z))
s.append(x * y + z)
s.append(x + y * z)
print(max(s))


a = int(input())
b = int(input())
c = int(input())
d1 = a + b + c
d2 = (a + b) * c
d3 = a * (b + c)
d4 = a * b * c
print(max(max(d1, d2), max(d3, d4)))


a = int(input())
b = int(input())
c = int(input())
f1 = a + b + c
f2 = a * b * c
f3 = a * (b + c)
f4 = (a + b) * c
f = [f1, f2, f3, f4]
print(max(f))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and b != 1 and (c != 1):
	print((a + b) * c)
elif a != 1 and b == 1 and (c != 1):
	if a < c:
		print((a + b) * c)
	else:
		print(a * (b + c))
elif a != 1 and b != 1 and (c == 1):
	print(a * (b + c))
elif a == 1 and b == 1 and (c != 1):
	print((a + b) * c)
elif a == 1 and c == 1 and (b != 1):
	print(a + b + c)
elif a != 1 and b == 1 and (c == 1):
	print(a * (b + c))
elif a == 1 and b == 1 and (c == 1):
	print(3)
else:
	print(a * b * c)


def func():
	ar = []
	a = int(input())
	b = int(input())
	c = int(input())
	ar.insert(0, a + b * c)
	ar.insert(1, a * (b + c))
	ar.insert(2, a * b * c)
	ar.insert(3, (a + b) * c)
	ar.insert(4, a + b + c)
	print(max(ar))
func()


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
if 1 not in l:
	print(a * b * c)
elif l.count(1) == 1:
	if a == 1 or (b == 1 and a <= c):
		print((a + b) * c)
	elif c == 1 or (b == 1 and c <= a):
		print(a * (b + c))
elif l.count(1) == 2:
	if a == 1 and b == 1 or (b == 1 and c == 1):
		l.sort()
		print(2 * l[-1])
	else:
		print(b + 2)
else:
	print(3)


a = int(input())
b = int(input())
c = int(input())
r = a * b * c
j = (a + b) * c
v = a * (b + c)
s = a + b + c
l = max(r, j, v, s)
print(l)


a = int(input())
b = int(input())
c = int(input())
arith = []
arith.append(a + b + c)
arith.append(a + b * c)
arith.append(a * b + c)
arith.append(a * b * c)
arith.append((a + b) * c)
arith.append(a * (b + c))
print(max(arith))


a = int(input(''))
b = int(input(''))
c = int(input(''))
minm = min([a, c])
maxm = max([a, c])
totals = []
totals.append((minm + b) * maxm)
totals.append(a * b * c)
totals.append(a + b + c)
print(max(totals))


def my_input():
	return (int(input()), int(input()), int(input()))

def calc(a, b, c):
	result = 6 * [0]
	result[0] = a + b + c
	result[1] = a + b * c
	result[2] = a * b + c
	result[3] = a * b * c
	result[4] = (a + b) * c
	result[5] = a * (b + c)
	return int(max(result))

def main():
	(a, b, c) = my_input()
	print(calc(a, b, c))
main()


nums = []
maximum = 0
for x in range(3):
	nums.append(int(input()))
if sum(nums) > maximum:
	maximum = sum(nums)
if nums[0] * nums[1] + nums[2] > maximum:
	maximum = nums[0] * nums[1] + nums[2]
if nums[0] * (nums[1] + nums[2]) > maximum:
	maximum = nums[0] * (nums[1] + nums[2])
if nums[0] + nums[1] * nums[2] > maximum:
	maximum = nums[0] + nums[1] * nums[2]
if (nums[0] + nums[1]) * nums[2] > maximum:
	maximum = (nums[0] + nums[1]) * nums[2]
if nums[0] * nums[1] * nums[2] > maximum:
	maximum = nums[0] * nums[1] * nums[2]
print(maximum)


a = int(input())
b = int(input())
c = int(input())
answer = list()
answer.append(a + b + c)
answer.append(a * b * c)
answer.append((a + b) * c)
answer.append(a * (b + c))
print(max(answer))


a = int(input())
b = int(input())
c = int(input())
j = a * b * c
k = (a + b) * c
l = c * (a + b)
g = (c + b) * a
h = a + b + c
print(max(g, j, k, l, h))


a = int(input())
b = int(input())
c = int(input())
if a == b == c == 1:
	aaa = 3
elif a == b == 1 or b == c == 1:
	aa = a * (b + c)
	bb = b * (a + c)
	cc = c * (a + b)
	aaa = max([aa, bb, cc])
elif a == c == 1:
	aaa = 2 + b
elif a == 1:
	aaa = b * c + c
elif c == 1:
	aaa = a * b + a
elif b == 1:
	aa = a * c + a
	bb = a * c + c
	aaa = max([aa, bb])
else:
	aa = a * c + a
	bb = a * c + c
	cc = a * b + a
	dd = a * b + b
	ee = b * c + b
	ff = b * c + c
	gg = a * b * c
	aaa = max([aa, bb, cc, dd, ee, ff, gg])
print(aaa)


a = int(input())
b = int(input())
c = int(input())
q = []
q.append((a + b) * c)
q.append(a * (b + c))
q.append(a * b * c)
q.append(a + b + c)
print(max(q))


l = []
for i in range(3):
	l.append(int(input()))
l1 = l[0] + l[1] * l[2]
l2 = l[0] * (l[1] + l[2])
l3 = l[0] * l[1] * l[2]
l4 = (l[0] + l[1]) * l[2]
l6 = l[0] + l[1] + l[2]
l7 = l[0] * l[1] + l[2]
l5 = []
l5.append(l1)
l5.append(l2)
l5.append(l3)
l5.append(l4)
l5.append(l6)
l5.append(l7)
print(max(l5))


v = []
for i in range(3):
	v.append(int(input()))
(a, b, c) = v
mayor = max([a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c)])
print(mayor)


a = int(input())
b = int(input())
c = int(input())
max_val = 0
if max_val < a + b + c:
	max_val = a + b + c
if max_val < a * b * c:
	max_val = a * b * c
if max_val < a + b * c:
	max_val = a + b * c
if max_val < a * (b + c):
	max_val = a * (b + c)
if max_val < (a + b) * c:
	max_val = (a + b) * c
print(max_val)


d = [int(input()) for num in range(3)]
max = 0
if d[0] + d[1] + d[2] > max:
	max = d[0] + d[1] + d[2]
if (d[0] + d[1]) * d[2] > max:
	max = (d[0] + d[1]) * d[2]
if d[0] + d[1] * d[2] > max:
	max = d[0] + d[1] * d[2]
if d[0] * d[1] * d[2] > max:
	max = d[0] * d[1] * d[2]
if d[0] * (d[1] + d[2]) > max:
	max = d[0] * (d[1] + d[2])
print(max)


a = int(input())
b = int(input())
c = int(input())
first = (a + b) * c
second = a + b * c
third = a + b + c
forth = a * b * c
fifth = a * b + c
sixth = a * (b + c)
result = max(first, second, third, forth, fifth, sixth)
print(result)


a = int(input())
b = int(input())
c = int(input())
v = a + b + c
w = (a + b) * c
x = a + b * c
y = a * b * c
z = a * (b + c)
l = [v, w, x, y, z]
print(max(l))


a1 = int(input())
a2 = int(input())
a3 = int(input())
listValue = [a1 * a2 * a3, a1 * (a2 + a3), a1 * a2 + a3, a1 + a2 * a3, (a1 + a2) * a3, a1 + a2 + a3]
maxValue = listValue[0]
for x in listValue:
	if x > maxValue:
		maxValue = x
print(maxValue)


a = int(input())
b = int(input())
c = int(input())
addx = a + b * c
xadd = a * (b + c)
axbxc = a * b * c
abaddx = (a + b) * c
axbc = a * b + c
abc = a + b + c
print(max(addx, xadd, axbxc, abaddx, axbc, abc))


a = int(input())
b = int(input())
c = int(input())
num1 = a * b * c
num2 = a * (b + c)
num3 = a * b + c
num4 = a + b * c
num5 = (a + b) * c
num6 = a + b + c
print(max(num1, num2, num3, num4, num5, num6))


a = int(input())
b = int(input())
c = int(input())
max_abc = 0
if a + b + c > max_abc:
	max_abc = a + b + c
if a * b * c > max_abc:
	max_abc = a * b * c
if (a + b) * c > max_abc:
	max_abc = (a + b) * c
if a * (b + c) > max_abc:
	max_abc = a * (b + c)
if a + b * c > max_abc:
	max_abc = a + b * c
if a * b + c > max_abc:
	max_abc = a * b + c
print(max_abc)


num1 = int(input())
num2 = int(input())
num3 = int(input())
max = 0
a = num1 + num2 * num3
b = num1 * (num2 + num3)
c = num1 * num2 * num3
d = (num1 + num2) * num3
e = num1 + num2 + num3
if a > max:
	max = a
if b > max:
	max = b
if c > max:
	max = c
if d > max:
	max = d
if e > max:
	max = e
print(max)


a = int(input())
b = int(input())
c = int(input())
math1 = a * b + c
math2 = a + b * c
math3 = a * b * c
math4 = (a + b) * c
math5 = a * (b + c)
math6 = a + b + c
listmath = [math1, math2, math3, math4, math5, math6]
bestmath = math1
for i in range(1, 6):
	if listmath[i] > bestmath:
		bestmath = listmath[i]
print(bestmath)


a = int(input())
b = int(input())
c = int(input())
t1 = a + b + c
t2 = a + b * c
t3 = (a + b) * c
t4 = a * b + c
t5 = a * (b + c)
t6 = a * b * c
print(max(t1, t2, t3, t4, t5, t6))


def list_input():
	return list(map(int, input().split()))

def multiple_input():
	return map(int, input().split())
a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
elif a == 1 and b == 1 and (c == 1):
	print(3)
else:
	t1 = (a + b) * c
	t2 = a * (b + c)
	t3 = a + b * c
	t4 = a * b + c
	t5 = a + b + c
	t6 = a * b * c
	print(max(t1, t2, t3, t4, t5, t6))


def parse():
	inputs = []
	for i in range(3):
		inputs.append(int(input()))
	return inputs

def solve():
	inputs = parse()
	a = inputs[0]
	b = inputs[1]
	c = inputs[2]
	print(max(a + b + c, a + b * c, a * (b + c), (a + b) * c, a * b * c, a * b + c))
solve()


a = int(input())
b = int(input())
c = int(input())
(l1, l2, l3) = ([], [], [])
if a > c:
	x = a * (b + c)
	l1.append(x)
	x1 = a + b + c
	l1.append(x1)
	x2 = a * b * c
	l1.append(x2)
	print(max(l1))
else:
	y = (a + b) * c
	l2.append(y)
	y1 = a + b + c
	l2.append(y1)
	y2 = a * b * c
	l2.append(y2)
	print(max(l2))


a = int(input())
b = int(input())
c = int(input())
arr = []
firstEx = a + b * c
arr.append(firstEx)
secondEx = a * (b + c)
arr.append(secondEx)
thirdEx = a * b * c
arr.append(thirdEx)
fourEx = (a + b) * c
arr.append(fourEx)
fiveEx = a + b + c
arr.append(fiveEx)
arr.sort()
print(arr[4])


a = int(input())
b = int(input())
c = int(input())
res = a + b * c
aux = a * (b + c)
if aux > res:
	res = aux
aux = a * b * c
if aux > res:
	res = aux
aux = a + b + c
if aux > res:
	res = aux
aux = (a + b) * c
if aux > res:
	res = aux
print(str(res))


a = int(input())
b = int(input())
c = int(input())
rs1 = a + b + c
rs2 = a + b * c
rs3 = a * b * c
rs4 = a * b + c
rs5 = (a + b) * c
rs6 = a * (b + c)
print(max(rs1, rs2, rs3, rs4, rs5, rs6))


(n, m, o) = [int(input()) for i in 'abc']
print(max(n * m * o, n * (m + o), (n + m) * o, n + m + o))


a = int(input())
b = int(input())
c = int(input())
l = a + b + c
x = a * b * c
y = (a + b) * c
z = a * (b + c)
print(max(x, y, z, l))


import math
import random
import itertools
import collections
import sys
import time
import fractions
import os
import functools
import bisect

def timer(f):

	def tmp(*args, **kwargs):
		t = time.time()
		res = f(*args, **kwargs)
		print('Время выполнения функции: %f' % (time.time() - t))
		return res
	return tmp

def contains(l, elem):
	index = bisect.bisect_left(l, elem)
	if index < len(l):
		return l[index] == elem
	return False
a = int(input())
b = int(input())
c = int(input())
array = []
array.append(a + b + c)
array.append(a + b * c)
array.append(a * b + c)
array.append(a * b * c)
array.append(a + b + c)
array.append((a + b) * c)
array.append(a * b + c)
array.append(a * b * c)
array.append(a + (b + c))
array.append(a + b * c)
array.append(a * (b + c))
array.append(a * (b * c))
print(max(array))


a = int(input())
b = int(input())
c = int(input())
x_1 = a + b + c
x_2 = a * b * c
x_3 = a + b * c
x_4 = a * b + c
x_5 = (a + b) * c
x_6 = a * (b + c)
print(max(x_1, x_2, x_3, x_4, x_5, x_6))


def Expression(a, b, c):
	maxVal = 0
	if a + b + c > maxVal:
		maxVal = a + b + c
	if a * b + c > maxVal:
		maxVal = a * b + c
	if a * (b + c) > maxVal:
		maxVal = a * (b + c)
	if a + b * c > maxVal:
		maxVal = a + b * c
	if (a + b) * c > maxVal:
		maxVal = (a + b) * c
	if a * b * c > maxVal:
		maxVal = a * b * c
	return maxVal
a = int(input())
b = int(input())
c = int(input())
print(Expression(a, b, c))


a = int(input())
b = int(input())
c = int(input())
s = []
s.append(a + b + c)
s.append(a + b * c)
s.append(a * (b + c))
s.append(a * b * c)
s.append((a + b) * c)
print(max(s))


a = int(input())
b = int(input())
c = int(input())
high = a + b + c
if (a + b) * c > high:
	high = (a + b) * c
if a * (b + c) > high:
	high = a * (b + c)
if a * b * c > high:
	high = a * b * c
print(high)


a = int(input())
b = int(input())
c = int(input())
bigNum = 0
check = []
check.append(a + b + c)
check.append(a * (b + c))
check.append((a + b) * c)
check.append(a * b * c)
print(max(check))


a = int(input())
b = int(input())
c = int(input())
z = []
z.append(a + b + c)
z.append((a + b) * c)
z.append(a * (b + c))
z.append(a * b * c)
z.append(a * b + c)
z.append(a + b * c)
print(max(z))


a = int(input())
b = int(input())
c = int(input())
if a == 1 or a == 0:
	r = a + b
	if c == 1 or c == 0:
		r += c
	else:
		r *= c
elif b == 1 or b == 0:
	r = b + min(a, c)
	if max(a, c) == 0 or max(a, c) == 1:
		r += max(a, c)
	else:
		r *= max(c, a)
elif c == 1 or c == 0:
	r = a * (b + c)
else:
	r = a * b * c
print(r)


import sys
if False:
	input = open('expressions.txt', 'r')
else:
	input = sys.stdin
a = int(input.readline().strip())
b = int(input.readline().strip())
c = int(input.readline().strip())
d = a * b * c
e = a + b + c
f = a * b + c
g = a * (b + c)
h = (a + b) * c
i = a + b * c
listed = []
listed.append(d)
listed.append(e)
listed.append(f)
listed.append(g)
listed.append(h)
listed.append(i)
listed.sort()
print(listed[len(listed) - 1])


a = int(input())
b = int(input())
c = int(input())
t = [a + b + c, a * (b + c), (a + b) * c, a * b * c]
t.sort()
print(t[3])


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	if c == 1:
		print(a + b + c)
	else:
		print((a + b) * c)
elif b == 1:
	if c == 1:
		print(a * 2)
	else:
		m = (a + 1) * c
		n = (c + 1) * a
		s = max(m, n)
		print(s)
elif c == 1:
	print(a * (b + 1))
else:
	print(a * b * c)


x = int(input())
y = int(input())
z = int(input())
max = x * y * z
value = (x + y) * z
if value > max:
	max = value
value = x * (y + z)
if value > max:
	max = value
value = x + y * z
if value > max:
	max = value
value = x + y + z
if value > max:
	max = value
print(max)


(a, b, c) = (int(input()), int(input()), int(input()))
prod = 0
if a == 1:
	prod = a + b
	if c == 1:
		prod += c
	else:
		prod *= c
elif b == 1:
	if c == 1:
		prod = b + c
		prod *= a
	elif c > a:
		prod = a + b
		prod *= c
	else:
		prod = b + c
		prod *= a
elif c == 1:
	prod = b + c
	prod *= a
if prod == 0:
	print(a * b * c)
else:
	print(prod)


n = int(input())
m = int(input())
o = int(input())
s = 0
s = max(n + m + o, (n + m) * o, n + o * m, n * (o + m), n * m + o, n * m * o)
print(s)


a = []
for i in range(3):
	a.append(int(input()))
p = [sum(a), a[0] * (a[1] + a[2]), a[0] * a[1] * a[2], a[0] + a[1] * a[2], (a[0] + a[1]) * a[2]]
print(max(p))


l = [int(input()), int(input()), int(input())]
r = 0
if l.count(1) == 3:
	print(3)
elif l.count(1) == 2:
	if l[1] != 1:
		print(max(l) + 2)
	else:
		print(max(l) * 2)
elif l.count(1) == 1:
	if l[0] == 1:
		print((l[0] + l[1]) * l[2])
	elif l[1] == 1:
		print(max((l[0] + l[1]) * l[2], l[0] * (l[1] + l[2])))
	else:
		print(l[0] * (l[1] + l[2]))
else:
	print(l[0] * l[1] * l[2])


a = int(input())
b = int(input())
c = int(input())
p = a + b * c
q = a * (b + c)
r = a * b * c
s = (a + b) * c
z = a + b + c
if a == 1 and c == 1:
	print(z, end='')
elif a == 1:
	print(s, end='')
elif b == 1:
	print(max(s, q))
elif c == 1:
	print(q, end='')
else:
	print(r, end='')


def f(a, b, c):
	d = max(a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c))
	return d
a = int(input())
b = int(input())
c = int(input())
print(f(a, b, c))


a = int(input())
b = int(input())
c = int(input())
ab = []
ab.append(a * b * c)
ab.append((a + b) * c)
ab.append(a * (b + c))
ab.append(a + b + c)
print(max(ab))


n = []
results = []
for i in range(3):
	n.append(input())
n = list(map(int, n))
(a, b, c) = (n[0], n[1], n[2])
results.append(a + b + c)
results.append((a + b) * c)
results.append(a + b * c)
results.append(a * (b + c))
results.append(a * b + c)
results.append(a * b * c)
print(max(results))


a = []
for i in range(3):
	a.append(int(input()))
if 1 not in a:
	print(a[0] * a[1] * a[2])
elif a[0] == 1 and a[1] == 1 and (a[2] == 1):
	print('3')
elif a[0] == 1 and a[2] == 1:
	print(a[1] + 2)
elif a[0] == 1:
	print((a[0] + a[1]) * a[2])
elif a[2] == 1:
	print(a[0] * (a[1] + a[2]))
elif a[0] <= a[2]:
	print((a[0] + a[1]) * a[2])
else:
	print(a[0] * (a[1] + a[2]))


a = int(input())
b = int(input())
c = int(input())
k = a * (b + c)
l = a * b * c
p = (a + b) * c
o = a + b + c
n = b * (a + c)
print(max(o, k, l, p))


a = int(input())
b = int(input())
c = int(input())
ans = [0] * 5
ans[0] = a + b * c
ans[1] = a * (b + c)
ans[2] = a * b * c
ans[3] = (a + b) * c
ans[4] = a + b + c
maxd = 0
for i in range(5):
	if ans[i] > maxd:
		maxd = ans[i]
print(maxd)


A = int(input())
B = int(input())
C = int(input())
D = A + B + C
E = (A + B) * C
F = A + B * C
G = A * B + C
H = A * (B + C)
I = A * B * C
if D >= E:
	J = D
else:
	J = E
if F >= J:
	J = F
if G >= J:
	J = G
if H >= J:
	J = H
if I >= J:
	J = I
print(J)


a = int(input())
b = int(input())
c = int(input())
lst = [0] * 4
lst[0] = a + b + c
lst[1] = (a + b) * c
lst[2] = a * (b + c)
lst[3] = a * b * c
print(max(lst))


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = (a + b) * c
z = a * (b + c)
k = a * b * c
print(max(x, y, z, k))


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
a = ii()
b = ii()
c = ii()
if a == b == c == 1:
	ans = a + b + c
elif a == 1 and b == 1 or (b == 1 and c == 1) or (c == 1 and a == 1):
	if c != 1:
		ans = max(a + b + c, (a + b) * c)
	elif a != 1:
		ans = max(a + b + c, (c + b) * a)
	else:
		ans = a + b + c
elif a == 1 or b == 1 or c == 1:
	if a == 1:
		ans = (a + b) * c
	elif b == 1:
		ans = max(a * (b + c), (a + b) * c)
	else:
		ans = a * (b + c)
else:
	ans = a * b * c
print(ans)


a = int(input())
b = int(input())
c = int(input())
q = a + b + c
r = a * b + c
s = a * b + c
t = a * (b + c)
u = a * b * c
v = a * b * c
w = a * (b * c)
x = a + b * c
y = (a + b) * c
z = a + b * c
values = [q, r, s, t, u, v, w, x, y, z]
values.sort()
print(values[-1])


a = int(input())
b = int(input())
c = int(input())
x = a * b * c
y = (a + b) * c
z = a * (b + c)
v = a + b + c
print(max(x, y, z, v))


def get_max():
	max_val = a * b * c
	max_val = max(max_val, (a + b) * c)
	max_val = max(max_val, a * (b + c))
	max_val = max(max_val, a + b + c)
	return max_val
a = int(input())
b = int(input())
c = int(input())
print(get_max())


a = int(input())
h = []
b = int(input())
c = int(input())
primer = a * b * c
primer2 = a + b * c
primer3 = (a + b) * c
primer4 = a * b * c
primer5 = a + b + c
primer6 = a * (b * c)
primer7 = a * (b + c)
h.append(primer7)
h.append(primer6)
h.append(primer3)
h.append(primer4)
h.append(primer5)
h.append(primer)
h.append(primer2)
print(max(h))


I = lambda : int(input())
a = I()
b = I()
c = I()
if b > 1:
	b = a * b * c + (a == 1) * c + (c == 1) * a
else:
	b = (1 + min(a, c)) * max(a, c) + (max(a, c) == 1)
print(b)


def expmax(a, b, c):
	l = []
	l.append(a + b * c)
	l.append(a * (b + c))
	l.append(a * b + c)
	l.append((a + b) * c)
	l.append(a * b * c)
	l.append(a + b + c)
	print(max(l))
a = int(input())
b = int(input())
c = int(input())
expmax(a, b, c)


a = int(input())
b = int(input())
c = int(input())
value = []
value.append(a + b + c)
value.append(a * b + c)
value.append(a + b * c)
value.append(a * b * c)
value.append((a + b) * c)
value.append(a * (b + c))
value.sort(reverse=True)
print(value[0])


from sys import stdin, stdout
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
stdout.write(str(max(a * b * c, a + b + c, (a + b) * c, a * (b + c), a + b * c, a * b + c)) + '\n')


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())
a = ini()
b = ini()
c = ini()
m = -1
s = (a + b) * c
m = max(m, s)
s = a + b + c
m = max(m, s)
s = a * (b + c)
m = max(m, s)
s = a * b + c
m = max(m, s)
s = a + b * c
m = max(m, s)
s = a * b * c
m = max(m, s)
print(m)


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
w = (a + b) * c
k = a + b + c
if x > y and x > z and (x > w) and (x > k):
	print(x)
if y > x and y > z and (y > w) and (y > k):
	print(y)
if z > y and z > x and (z > w) and (z > k):
	print(z)
if w > y and w > z and (w > x) and (w > k):
	print(w)
if k > x and k > y and (k > z) and (k > w):
	print(k)
if x == y and x == y != z and (x == y != w) and (z == y != k) and (x > z) and (x > w) and (x > k):
	print(x)
if x == z and x == z != y and (x == z != w) and (z == z != k) and (x > y) and (x > w) and (x > k):
	print(x)
if x == w and x == w != z and (x == w != y) and (x == w != k) and (x > z) and (x > y) and (x > k):
	print(x)
if x == k and x == k != y and (x == k != z) and (x == k != w) and (x > y) and (x > z) and (x > w):
	print(x)
if y == z and y == z != x and (y == z != w) and (y == z != k) and (y > x) and (y > w) and (y > k):
	print(y)
if y == w and y == w != x and (y == w != z) and (y == w != k) and (y > z) and (y > x) and (y > k):
	print(y)
if y == k and y == k != x and (y == k != z) and (y == k != w) and (y > z) and (y > w) and (y > x):
	print(y)
if z == w and z == w != x and (z == w != y) and (z == w != k) and (z > x) and (z > y) and (z > k):
	print(z)
if w == k and w == k != x and (w == k != z) and (w == k != y) and (w > z) and (w > y) and (w > x):
	print(w)
if x == y == z and x > w and (x > k):
	print(x)
if x == y == w and x > z and (x > k):
	print(x)
if x == y == k and x > z and (x > w):
	print(x)
if x == z == w and x > y and (x > k):
	print(x)
if x == z == k and x > y and (x > w):
	print(x)
if y == z == w and y > x and (y > k):
	print(y)
if y == z == k and y > x and (y > w):
	print(y)
if z == w == k and z > x and (z > y):
	print(z)
if x == y == z == w and x > k:
	print(x)
if x == y == z == k and x > w:
	print(x)
if x == z == w == k and x > y:
	print(x)
if y == z == w == k and y > x:
	print(y)
if x == y == z == w == k:
	print(x)


a = int(input())
b = int(input())
c = int(input())
e_1 = a * b * c
e_2 = (a + b) * c
e_3 = a + b * c
e_4 = a + b + c
e_5 = a * (b + c)
e_6 = a * b + c
print(max(e_1, e_2, e_3, e_4, e_5, e_6))


a = int(input())
b = int(input())
c = int(input())
w = a + b * c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
e = a + b + c
print(max(w, x, y, z, e))


from sys import stdin

def maximo(a, b, c):
	m = (a + b) * c
	n = a * (b + c)
	p = a * b * c
	w = a + b + c
	if m >= n and m >= p and (m >= w):
		return m
	elif n >= m and n >= p and (n >= w):
		return n
	elif p >= n and p >= m and (p >= w):
		return p
	elif w >= m and w >= n and (w >= p):
		return w
	else:
		return m

def main():
	a = int(stdin.readline().strip())
	b = int(stdin.readline().strip())
	c = int(stdin.readline().strip())
	print(maximo(a, b, c))
main()


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
sys.setrecursionlimit(10 ** 5)

def mod():
	return 10 ** 9 + 7

def i():
	return sys.stdin.readline().strip()

def ii():
	return int(sys.stdin.readline())

def li():
	return list(sys.stdin.readline().strip())

def mii():
	return map(int, sys.stdin.readline().split())

def lii():
	return list(map(int, sys.stdin.readline().strip().split()))

def solve():
	a = ii()
	b = ii()
	c = ii()
	print(max(a * b * c, (a + b) * c, a * (b + c), a + b + c))
for _ in range(1):
	solve()


i = input
n = int
(a, b, c) = (n(i()), n(i()), n(i()))
print(max(a * b * c, a + b + c, a + b * c, a * (b + c), (a + b) * c))


a = int(input())
b = int(input())
c = int(input())
z1 = a + b + c
x1 = a * b + c
x2 = a * (b + c)
v1 = a + b * c
v2 = (a + b) * c
q1 = a * b * c
res = max(z1, x1, x2, v1, v2, q1)
print(res)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	li = []
	li.append(a + b + c)
	li.append(a * b * c)
	li.append((a + b) * c)
	li.append(a * b + c)
	li.append(a + (b + c))
	li.append(a * (b * c))
	li.append(a + b * c)
	li.append(a * (b + c))
	print(max(li))
main()


from sys import stdin

def exp(num1, num2, num3):
	op1 = num1 + num2 * num3
	op2 = num1 * (num2 + num3)
	op3 = num1 * num2 * num3
	op4 = (num1 + num2) * num3
	op5 = num1 + num2 + num3
	if op1 >= op2 and op1 >= op3 and (op1 >= op4) and (op1 >= op5):
		res = op1
	elif op2 >= op1 and op2 >= op3 and (op2 >= op4) and (op2 >= op5):
		res = op2
	elif op3 >= op1 and op3 >= op2 and (op3 >= op4) and (op3 >= op5):
		res = op3
	elif op4 >= op1 and op4 >= op2 and (op4 >= op3) and (op4 >= op5):
		res = op4
	else:
		res = op5
	print(res)

def main():
	num1 = int(stdin.readline())
	num2 = int(stdin.readline())
	num3 = int(stdin.readline())
	exp(num1, num2, num3)
main()


a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	x = a + b + c
elif a == 1 and b > 1 and (c == 1):
	x = a + b + c
elif a == 1:
	x = (a + b) * c
elif b == 1:
	if a > c:
		x = a * (b + c)
	else:
		x = (a + b) * c
elif c == 1:
	x = a * (b + c)
else:
	x = a * b * c
print(x)


a = int(input())
b = int(input())
c = int(input())
li = []
x1 = a + b * c
li.append(x1)
x2 = a * (b + c)
li.append(x2)
x3 = a * b * c
li.append(x3)
x4 = (a + b) * c
li.append(x4)
x5 = a + b + c
li.append(x5)
li.sort()
print(li[-1])


a = int(input())
b = int(input())
c = int(input())
m = []
m.append(a + b + c)
m.append(a * b + c)
m.append(a * (b + c))
m.append(a * b * c)
m.append(a + b * c)
m.append((a + b) * c)
print(sorted(m)[len(m) - 1])


a = int(input(''))
b = int(input(''))
c = int(input(''))
highest = -1
if a + b + c > highest:
	highest = a + b + c
if a * (b + c) > highest:
	highest = a * (b + c)
if (a + b) * c > highest:
	highest = (a + b) * c
if a * b * c > highest:
	highest = a * b * c
print(highest)


a = int(input())
b = int(input())
c = int(input())
n = a + b + c
d = a * b * c
e = (a + b) * c
f = a * (b + c)
print(max(n, d, e, f))


a = int(input())
b = int(input())
c = int(input())
s = a + b + c
if a + b * c > s:
	s = a + b * c
if a * b + c > s:
	s = a * b + c
if a * (b + c) > s:
	s = a * (b + c)
if (a + b) * c > s:
	s = (a + b) * c
if a * b * c > s:
	s = a * b * c
print(s)


a = int(input())
b = int(input())
c = int(input())
first = a + b * c
sec = (a + b) * c
third = a * (b + c)
fourth = a * b * c
fifth = a + b + c
print(max([first, sec, third, fourth, fifth]))


num = [0, 0, 0]
num[0] = int(input())
num[1] = int(input())
num[2] = int(input())
res = 0
for i in range(2):
	if (num[i] + num[i + 1]) * num[(i + 2) % 3] > res:
		res = (num[i] + num[i + 1]) * num[(i + 2) % 3]
if res < num[0] * num[1] * num[2]:
	res = num[0] * num[1] * num[2]
if res < num[0] + num[1] + num[2]:
	res = num[0] + num[1] + num[2]
print(res)


def get_max_value():
	a = int(input())
	b = int(input())
	c = int(input())
	numbers = [a, b, c]
	max_val = get_max(numbers)
	return max_val

def get_max(numbers):
	if len(numbers) == 0:
		return 0
	ls = list()
	for (i, num) in enumerate(numbers):
		if i == 1:
			continue
		cur_number = numbers[i]
		recursed_number = get_max(numbers[0:i] + numbers[i + 1:])
		n1 = cur_number + recursed_number
		n2 = cur_number * recursed_number
		ls.append(n1)
		ls.append(n2)
	return max(ls)
print(get_max_value())


a = int(input())
b = int(input())
c = int(input())
option1 = a + b + c
option2 = (a + b) * c
option3 = a * (b + c)
option4 = a * b * c
answer = max(option1, option2, option3, option4)
print(answer)


a = int(input())
b = int(input())
c = int(input())
a1 = a + b * c
a2 = a * b + c
a3 = (a + b) * c
a4 = a * (b + c)
a5 = a * b * c
a6 = a + b + c
m1 = max(a1, a2)
m2 = max(a3, a4)
m3 = max(a5, a6)
m4 = max(m1, m2)
m5 = max(m4, m3)
print(m5)


n1 = int(input())
n2 = int(input())
n3 = int(input())
r1 = n1 + n2 * n3
r2 = n1 * (n2 + n3)
r3 = n1 * n2 * n3
r4 = (n1 + n2) * n3
r5 = n1 + n2 + n3
li = (r1, r2, r3, r4, r5)
print(max(li))


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
l.sort()
m1 = a * b * c
m2 = (a + b) * c
m3 = l[0] + l[1] * l[2]
m4 = a * (b + c)
m5 = a + b + c
print(max(m1, m2, m3, m4, m5))


b = int(input())
c = int(input())
d = int(input())
e = b + c * d
if b * (c + d) > e:
	e = b * (c + d)
if b * c * d > e:
	e = b * c * d
if (b + c) * d > e:
	e = (b + c) * d
if b + c + d > e:
	e = b + c + d
print(e)


a = int(input())
b = int(input())
c = int(input())
res1 = a + b * c
res2 = a * (b + c)
res3 = a * b * c
res4 = (a + b) * c
res5 = a + b + c
expres = [res1, res2, res3, res4, res5]
print(max(expres))


nums = []
for i in range(3):
	temp = int(input())
	nums.append(temp)
ans = max(sum(nums), nums[0] + nums[1] * nums[2], (nums[0] + nums[1]) * nums[2], nums[0] * nums[1] + nums[2], nums[0] * (nums[1] + nums[2]), nums[0] * nums[1] * nums[2])
print(ans)


A = []
for i in range(3):
	n = input()
	A.append(n)
A = [int(i) for i in A]
a = A[0]
b = A[1]
c = A[2]
m1 = a + b + c
m2 = a + b * c
m3 = a * b + c
m5 = (a + b) * c
m7 = (c + b) * a
m8 = a * b * c
print(max(m1, m2, m3, m5, m7, m8))


from __future__ import division, print_function
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans
a = ii()
b = ii()
c = ii()
e = a + b + c
f = a * b + c
x = a + b * c
y = a * (b + c)
z = a * b * c
w = (a + b) * c
print(max(w, x, y, z, e, f))


integers = [int(input()) for i in range(3)]
opr1 = integers[0] + integers[1] * integers[2]
opr2 = integers[0] * (integers[1] + integers[2])
opr3 = (integers[0] + integers[1]) * integers[2]
opr4 = integers[0] * integers[1] * integers[2]
opr5 = integers[0] + integers[1] + integers[2]
print(max(opr1, opr2, opr3, opr4, opr5))


a = int(input())
b = int(input())
c = int(input())
d1 = a + b + c
d2 = (a + b) * c
d3 = a * (b + c)
d4 = a * b * c
d5 = a + b * c
d6 = a * b + c
result = [d1, d2, d3, d4, d5, d6]
result.sort()
print(str(result[-1]))


import math
a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = (b + c) * a
f = a * b * c
g = (a + b) * c
h = a + b + c
print(max(d, e, f, g, h))


import sys
(a, b, c) = map(int, sys.stdin.read().split())
print(max([a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c)]))


a = int(input())
b = int(input())
c = int(input())
ml = []
c1 = a + b * c
ml.append(c1)
c2 = a * (b + c)
ml.append(c2)
c3 = a * b * c
ml.append(c3)
c4 = (a + b) * c
ml.append(c4)
c5 = a + b + c
ml.append(c5)
print(max(ml))


a = int(input())
b = int(input())
c = int(input())
res = 0
if a + b * c > res:
	res = a + b * c
if a * (b + c) > res:
	res = a * (b + c)
if a * b * c > res:
	res = a * b * c
if (a + b) * c > res:
	res = (a + b) * c
if a + b + c > res:
	res = a + b + c
print(res)


n1 = int(input())
n2 = int(input())
n3 = int(input())
arr = []
arr.append(n1 * n2 * n3)
arr.append(n1 + n2 + n3)
arr.append(n1 * (n2 + n3))
arr.append(n1 + n2 * n3)
arr.append((n1 + n2) * n3)
arr.append(n1 * n2 + n3)
print(max(arr))


a = int(input())
b = int(input())
c = int(input())
f = 0
arr = [a, b, c]
if a == 1 and b != 1 and (c != 1):
	f = (a + b) * c
	print(f)
elif a == 1 and b == 1 and (c != 1):
	f = 2 * c
	print(f)
elif a == 1 and b == 1 and (c == 1):
	print(3)
elif a != 1 and b == 1 and (c != 1):
	if a > c:
		f = a * (b + c)
		print(f)
	else:
		f = c * (a + b)
		print(f)
elif a != 1 and b == 1 and (c == 1):
	f = 2 * a
	print(f)
elif a != 1 and b != 1 and (c == 1):
	f = a * (b + c)
	print(f)
elif a == 1 and b != 1 and (c == 1):
	f = b + 2
	print(f)
else:
	f = a * b * c
	print(f)


vals = [int(input()) for _ in range(3)]
if vals[0] == 1 and vals[2] == 1:
	res = sum(vals)
elif vals[1] == 1:
	if vals[0] > vals[2]:
		res = (1 + vals[2]) * vals[0]
	else:
		res = (1 + vals[0]) * vals[2]
elif vals[0] == 1:
	res = (1 + vals[1]) * vals[2]
elif vals[2] == 1:
	res = (1 + vals[1]) * vals[0]
else:
	res = vals[0] * vals[1] * vals[2]
print(res)


n1 = int(input())
n2 = int(input())
n3 = int(input())
a = n1 + n2 + n3
b = n1 + n2 * n3
c = n1 * n2 + n3
d = n1 * n2 * n3
e = (n1 + n2) * n3
f = n1 * n2 + n3
g = n1 + n2 * n3
h = n1 * (n2 + n3)
print(max(a, b, c, d, e, f, g, h))


a = int(input())
b = int(input())
c = int(input())
list = []
list.append(a + b * c)
list.append((a + b) * c)
list.append(a * b + c)
list.append(a * (b + c))
list.append(a + b + c)
list.append(a * b * c)
list.sort()
print(list[5])


a = int(input())
b = int(input())
c = int(input())
q1 = a * b * c
q2 = (a + b) * c
q3 = a * (b + c)
q4 = a + b * c
q5 = a * b + c
q6 = a + b + c
print(max(max(max(q1, q2), max(q3, q4)), max(q5, q6)))


abc = []
for i in range(3):
	temp = int(input())
	abc.append(temp)
a = abc[0]
b = abc[1]
c = abc[2]
t = max(a + b + c, a * b * c, (a + b) * c, a * b + c, a * (b + c), a + b * c)
print(t)


a = int(input())
b = int(input())
c = int(input())
y = a + b * c
x = a * (b + c)
z = a * b * c
u = (a + b) * c
i = a + b + c
list = [y, x, z, u, i]
print(max(list))


l = []
for i in range(3):
	n = int(input())
	l.append(n)
v = l[0] * (l[1] + l[2])
s = (l[0] + l[1]) * l[2]
u = sum(l)
t = l[0] * l[1] * l[2]
print(max(s, t, u, v))


x1 = int(input())
x2 = int(input())
x3 = int(input())
test1 = x1 + x2 + x3
test2 = (x1 + x2) * x3
test3 = x1 * (x2 + x3)
test4 = x1 * x2 * x3
print(max(test1, test2, test3, test4))


A = int(input())
B = int(input())
C = int(input())
print(max(A + B + C, A * (B + C), (A + B) * C, A * B * C))


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
r = 0
if l.count(1) == 1:
	if (a + b) * c > a * (b + c):
		r = (a + b) * c
	else:
		r = a * (b + c)
elif l.count(1) == 2:
	if a == 1 and b == 1:
		r = 2 * c
	elif b == 1 and c == 1:
		r = 2 * a
	else:
		r = a + b + c
elif l.count(1) == 3:
	r = 3
else:
	r = a * b * c
print(r)


def f(x, i, j):
	if i == j:
		return x[i]
	mx = 0
	for k in range(i, j):
		f1 = f(x, i, k)
		f2 = f(x, k + 1, j)
		mx = max(mx, f1 + f2, f1 * f2)
	return mx
x = [int(input()) for _ in range(3)]
print(f(x, 0, len(x) - 1))


n1 = int(input())
n2 = int(input())
n3 = int(input())
list1 = [0] * 6
list1[0] = n1 * n2 * n3
list1[1] = n1 * (n2 + n3)
list1[2] = (n1 + n2) * n3
list1[3] = n1 * n2 + n3
list1[4] = n1 + n2 * n3
list1[5] = n1 + n2 + n3
print(max(list1))


my_list = []
for x in range(3):
	n = int(input())
	my_list.append(n)
maximum = sum(my_list)
if my_list[0] + my_list[1] * my_list[2] > maximum:
	maximum = my_list[0] + my_list[1] * my_list[2]
if (my_list[0] + my_list[1]) * my_list[2] > maximum:
	maximum = (my_list[0] + my_list[1]) * my_list[2]
if my_list[0] * my_list[1] * my_list[2] > maximum:
	maximum = my_list[0] * my_list[1] * my_list[2]
if my_list[0] * (my_list[1] + my_list[2]) > maximum:
	maximum = my_list[0] * (my_list[1] + my_list[2])
print(maximum)


from sys import stdin

def main():
	a = int(stdin.readline().strip())
	b = int(stdin.readline().strip())
	c = int(stdin.readline().strip())
	on = a + b + c
	tw = a * b * c
	tr = a + b * c
	fo = a * b + c
	fi = (a + b) * c
	si = a * (b + c)
	if on >= tw and on >= tr and (on >= fo) and (on >= fi) and (on >= si):
		print(on)
	elif tw >= on and tw >= tr and (tw >= fo) and (tw >= fi) and (tw >= si):
		print(tw)
	elif tr >= on and tr >= tw and (tr >= fo) and (tr >= fi) and (tr >= si):
		print(tr)
	elif fo >= on and fo >= tw and (fo >= tr) and (fo >= fi) and (fo >= si):
		print(fo)
	elif fi >= on and fi >= tw and (fi >= fo) and (fi >= tr) and (fi >= si):
		print(fi)
	elif si >= on and si >= tw and (si >= fo) and (si >= fi) and (si >= tr):
		print(si)
main()


x = int(input())
y = int(input())
z = int(input())
a = list()
a.append(x + y + z)
a.append(x * (y + z))
a.append(x * y * z)
a.append((x + y) * z)
print(max(a))


(a, b, c) = (int(input()) for i in range(3))
x1 = a * b * c
x4 = a + b * c
x6 = (a + b) * c
x8 = (b + c) * a
x2 = a + b + c
print(max(x1, x4, x6, x8, x2))


a = int(input())
b = int(input())
c = int(input())
print(str(max(a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c, a * b + c)) + '\n')


a = int(input())
b = int(input())
c = int(input())
r = []
r.append((a + b) * c)
r.append((b + c) * a)
r.append(a * b * c)
r.append(a + b + c)
r.append(a * b + c)
r.append(b * c + a)
print(max(r))


def put_braces_and_do_operations(a, param, param1, param2, ans):
	ans.append(a[param] * a[param1] * a[param2])
	ans.append(a[param] * a[param1] + a[param2])
	ans.append((a[param] + a[param1]) * a[param2])
	ans.append(a[param] + a[param1] + a[param2])
	pass

def main():
	a = []
	for _ in range(3):
		a.append(int(input()))
	ans = []
	put_braces_and_do_operations(a, 0, 1, 2, ans)
	put_braces_and_do_operations(a, 1, 2, 0, ans)
	print(max(ans))
	pass
main()


a = int(input())
b = int(input())
c = int(input())
temp = 0
if a < c:
	temp = a
	a = c
	c = temp
ans = max(max(a * (b + c), a * b * c), a + b + c)
print(ans)


l = list()
for i in range(3):
	l.append(int(input()))
x = max(max(l[0] + l[1], l[0] * l[1]) * l[2], max(l[0] + l[1], l[0] * l[1]) + l[2])
l = l[::-1]
print(max(max(l[0] + l[1], l[0] * l[1]) * l[2], max(l[0] + l[1], l[0] * l[1]) + l[2], x))


t = 1
while t:
	t -= 1
	a = []
	for i in range(3):
		x = int(input())
		a.append(x)
	x = max(a[0] + a[1], a[0] * a[1])
	y = max(a[1] + a[2], a[1] * a[2])
	print(max(x * a[2], x + a[2], a[0] * y, a[0] + y))


a = int(input())
b = int(input())
c = int(input())
ex = []
ex.append(a * b * c)
ex.append(a * b + c)
ex.append(a + b * c)
ex.append(a + b + c)
ex.append(a * (b + c))
ex.append((a + b) * c)
ex.sort(reverse=True)
print(ex[0])


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
if l.count(1) == 3:
	print(3)
elif l.count(1) == 2:
	if b == 1:
		if a == 1:
			print(2 * c)
		else:
			print(2 * a)
	else:
		print(b + 2)
elif l.count(1) == 1:
	if a == 1:
		print((a + b) * c)
	elif c == 1:
		print(a * (b + c))
	else:
		print(max(a * (b + c), (a + b) * c))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
values = []
values.append(a + b + c)
values.append(a + b * c)
values.append((a + b) * c)
values.append(a * b + c)
values.append(a * (b + c))
values.append(a * b * c)
values.sort(reverse=True)
print(values[0])


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def check(n, m, k):
	print('inside', n + (k - 1) * m, k * (k + 1) // 2, (n + (k - 1) * m) // k * k)
	if (n + (k - 1) * m) // k * k <= k * (k + 1) // 2:
		return True
	return False

def solve():
	a = []
	for i in range(3):
		a.append(int(input()))
	ans = max(max(a[0] * a[1] * a[2], (a[0] + a[1]) * a[2]), max(a[0] * (a[1] + a[2]), sum(a)))
	print(ans)
for _ in range(1):
	solve()


i = int(input())
j = int(input())
k = int(input())
p = max(i + j + k, i * j * k, (i + j) * k, i * (j + k))
print(p)


a = [int(input()), int(input()), int(input())]
print(max([sum(a), (a[0] + a[1]) * a[2], a[0] * (a[1] + a[2]), a[0] * a[1] * a[2]]))


x = int(input())
y = int(input())
z = int(input())
ans = []
ans.append(x * (y + z))
ans.append((x + y) * z)
ans.append(x * y * z)
ans.append(x + y + z)
ans.append(x + y * z)
ans.append(x * y + z)
print(max(ans))


ans = 0
a = int(input())
b = int(input())
c = int(input())
ans = max(ans, a + b + c)
ans = max(ans, a * b * c)
ans = max(ans, a + b * c)
ans = max(ans, a * b + c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
print(ans)


a = int(input())
b = int(input())
c = int(input())
e = 0
d = a + b * c
if e < d:
	e = d
	d = 0
else:
	d = 0
d = a * (b + c)
if e < d:
	e = d
	d = 0
else:
	d = 0
d = a * b * c
if e < d:
	e = d
	d = 0
else:
	d = 0
d = (a + b) * c
if e < d:
	e = d
	d = 0
else:
	d = 0
d = a + b + c
if e < d:
	e = d
	d = 0
else:
	d = 0
print(e)


import sys
import math
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
a = int(input())
b = int(input())
c = int(input())
ans = a + b + c
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
print(ans)


(a, b, c) = [int(input()) for _ in range(3)]
if a == 1:
	if c == 1:
		print(a + b + c)
	else:
		print((a + b) * c)
elif c == 1:
	print(a * (b + c))
elif b == 1:
	print((min(a, c) + b) * max(a, c))
else:
	print(a * b * c)


import sys
import math
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
res = 0
if a == 1 and b == 1 and (c == 1):
	print(3)
elif a == 1 and c == 1:
	print(2 + b)
elif a == 1:
	print((a + b) * c)
elif b == 1:
	if a <= c:
		print((a + b) * c)
	else:
		print(a * (b + c))
elif c == 1:
	print(a * (b + c))
else:
	print(a * b * c)


__author__ = 'JohnHook'
a = int(input())
b = int(input())
c = int(input())
print(max(a * b * c, (a + b) * c, a * (b + c), a + b + c))


a = int(input())
b = int(input())
c = int(input())
mayor = 0
if a + b * c > mayor:
	mayor = a + b * c
if a * (b + c) > mayor:
	mayor = a * (b + c)
if a * b * c > mayor:
	mayor = a * b * c
if (a + b) * c > mayor:
	mayor = (a + b) * c
if a + b + c > mayor:
	mayor = a + b + c
if a * b + c > mayor:
	mayor = a * b + c
print(mayor)


a = int(input())
b = int(input())
c = int(input())
case = []
case.append(a * b + c)
case.append(a + b * c)
case.append(a * b * c)
case.append(a + b + c)
case.append((a + b) * c)
case.append(a * (b + c))
print(max(case))


a = int(input())
b = int(input())
c = int(input())
ma = 0
if a == 1:
	if b == 1:
		if c == 1:
			ma = 3
		else:
			ma = (a + b) * c
	elif c == 1:
		ma = a + b + c
	else:
		ma = (a + b) * c
elif b == 1:
	if a <= c:
		ma = (a + b) * c
	else:
		ma = a * (b + c)
elif c == 1:
	ma = a * (b + c)
else:
	ma = a * b * c
print(ma)


a = int(input())
b = int(input())
c = int(input())

def fun():
	m = a + b * c
	n = a * (b + c)
	o = a * b * c
	p = (a + b) * c
	q = a + b + c
	print(max(m, n, o, p, q))
fun()


(a, b, c) = [int(input()) for i in range(3)]
formulas = [a + b * c, a * (b + c), (a + b) * c, a * b * c, a + b + c]
formulas = sorted(formulas)
print(formulas[-1])


n1 = int(input())
n2 = int(input())
n3 = int(input())
l = [n1 + n2 + n3, n1 * n2 * n3, n1 + n2 + n3, n1 + (n2 + n3), n1 + n2 * n3, n1 * (n2 + n3), n1 * n2 + n3, (n1 + n2) * n3]
print(max(l))


(a, b, c) = (int(input()), int(input()), int(input()))
aa = a + b + c
ab = a * b * c
ac = a * b + c
ad = a + b * c
ae = (a + b) * c
af = a * (b + c)
print(max(aa, ab, ac, ad, ae, af))


def max(p, q, r, s, u, v):
	if p >= q and p >= r and (p >= s) and (p >= u) and (p >= v):
		print(p)
	elif q >= p and q >= r and (q >= s) and (q >= u) and (q >= v):
		print(q)
	elif s >= p and s >= r and (s >= q) and (s >= u) and (s >= v):
		print(s)
	elif u >= p and u >= q and (u >= r) and (u >= s) and (u >= v):
		print(u)
	elif v >= p and v >= q and (v >= r) and (v >= s) and (v >= u):
		print(v)
	else:
		print(r)
a = int(input())
b = int(input())
c = int(input())
p = (a + b) * c
q = a + b * c
r = a + b + c
s = a * b * c
t = a * b + c
u = a * (b + c)
max(p, q, r, s, t, u)


a = int(input())
b = int(input())
c = int(input())
results = [a + b + c, a + b * c, a * b + c, a * b * c, a * (b + c), (a + b) * c]
maximum_value = max(results)
print(maximum_value)


masukan1 = int(input())
masukan2 = int(input())
masukan3 = int(input())
jumlah1 = masukan1 + masukan2 * masukan3
jumlah2 = masukan1 * (masukan2 + masukan3)
jumlah3 = masukan1 * masukan2 * masukan3
jumlah4 = (masukan1 + masukan2) * masukan3
jumlah5 = masukan1 + masukan2 + masukan3
tampung = [jumlah1, jumlah2, jumlah3, jumlah4, jumlah5]
for i in range(len(tampung) - 1):
	for j in range(i + 1, len(tampung)):
		if tampung[i] > tampung[j]:
			(tampung[j], tampung[i]) = (tampung[i], tampung[j])
print(tampung[len(tampung) - 1])


(a, b, c) = (int(input()), int(input()), int(input()))
d = [0, 0, 0, 0]
d[0] = (a + b) * c
d[1] = a + b + c
d[2] = a * b * c
d[3] = a * (b + c)
print(max(d))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	print(3)
	exit()
if b == 1:
	print((b + min(a, c)) * max(a, c))
	exit()
if a == 1 and c == 1:
	print(a + b + c)
	exit()
if a == 1:
	print((a + b) * c)
	exit()
if c == 1:
	print(a * (b + c))
	exit()
print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
l.sort()
ll = max(l[0] + l[1] * l[2], l[0] * l[1] + l[2], l[1] + l[0] * l[2], (l[0] + l[1]) * l[2], (l[0] + l[2]) * l[1], l[0] * l[1] * l[2], l[0] + l[1] + l[2])
ans = a + b + c
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
i = 0
d = (a + b) * c
i = i + d
e = a * b + c
if e > i:
	i = e
f = a + b * c
if f > i:
	i = f
g = a + b + c
if g > i:
	i = g
h = a * b * c
if h > i:
	i = h
l = a * (b + c)
if l > i:
	i = l
print(i)


a = int(input())
b = int(input())
c = int(input())
ab = a + b
bc = b + c
listpos = [a + b + c, a * b + c, a * bc, a + b * c, ab * c, a * b * c]
print(max(listpos))


number_a = input()
number_b = input()
number_c = input()
number_a = int(number_a)
number_b = int(number_b)
number_c = int(number_c)
lst = [number_a, number_b, number_c]
answers = list()
answers.append((lst[0] + lst[1]) * lst[2])
answers.append(lst[0] * lst[1] * lst[2])
answers.append(lst[0] * (lst[1] + lst[2]))
answers.append(lst[0] + (lst[1] + lst[2]))
print(max(answers))


a = int(input())
b = int(input())
c = int(input())
data = []
data.append((a + b) * c)
data.append(a * b * c)
data.append(a * (b + c))
data.append(a + b + c)
print(max(data))


a = int(input())
b = int(input())
c = int(input())
val1 = a * b * c
val2 = (a + b) * c
val3 = a * (b + c)
val4 = a + b * c
val5 = a * b + c
val6 = a + b + c
val = [val1, val2, val3, val4, val5, val6]
val.sort()
print(val[5])


a = int(input())
b = int(input())
c = int(input())
x = []
x.append(a * b * c)
x.append(a + b + c)
k = b * c
k += a
x.append(k)
k = a * b
k += c
x.append(k)
k = a + b
k *= c
x.append(k)
k = b + c
k *= a
x.append(k)
print(max(x))


def Main():
	a = int(input())
	b = int(input())
	c = int(input())
	if a == 1 and b == 1 and (c == 1):
		print(a + b + c)
	elif a + b == 2 or a + c == 2 or b + c == 2:
		if a + b == 2:
			print(2 * c)
		elif a + c == 2:
			print(2 + b)
		else:
			print(2 * a)
	elif a == 1 or b == 1 or c == 1:
		if a == 1:
			print((b + 1) * c)
		elif b == 1:
			if a < c:
				print((a + 1) * c)
			else:
				print(a * (c + 1))
		else:
			print((b + 1) * a)
	else:
		print(a * b * c)
Main()


a = int(input())
b = int(input())
c = int(input())
highest_ac = a if a > c else c
if a != 1 and b != 1 and (c != 1):
	print(a * b * c)
elif a == 1 and c == 1:
	print(a + b + c)
elif b == 1:
	print((a + b) * c if (a + b) * c > a * (b + c) else a * (b + c))
else:
	print(a * b * c + highest_ac)


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def solve():
	nums = []
	for i in range(3):
		nums.append(getInt())
	(A, B, C) = nums
	return max(A * B * C, A + B * C, (A + B) * C, A * B + C, A * (B + C), A + B + C)
ans = solve()
print(ans)


def main(a, b, c):
	sum_1 = a + b * c
	sum_2 = a * (b + c)
	sum_3 = a * b * c
	sum_4 = (a + b) * c
	sum_5 = a + b + c
	total = [sum_1, sum_2, sum_3, sum_4, sum_5]
	print(max(total))
a = int(input())
b = int(input())
c = int(input())
main(a, b, c)


from sys import stdin
_input = stdin.readline
(_max, _int) = (max, int)

def solution():
	a = _int(_input())
	b = _int(_input())
	c = _int(_input())
	print(_max(a * b + c, a * (b + c), a + b * c, (a + b) * c, a * b * c, a + b + c))
solution()


a = int(input())
b = int(input())
c = int(input())
s1 = a + b + c
s2 = a * b * c
s3 = (a + b) * c
s4 = a + b * c
s5 = a * b + c
s6 = a * (b + c)
s = 0
if s1 > s:
	s = s1
if s2 > s:
	s = s2
if s3 > s:
	s = s3
if s4 > s:
	s = s4
if s5 > s:
	s = s5
if s6 > s:
	s = s6
print(s)


a = int(input())
b = int(input())
c = int(input())
vir1 = a * (b + c)
vir2 = a * b * c
vir3 = (a + b) * c
vir4 = a + b + c
if vir1 >= vir2:
	if vir1 >= vir3:
		if vir1 >= vir4:
			print(vir1)
		else:
			print(vir4)
	elif vir3 > vir4:
		print(vir3)
	else:
		print(vir4)
elif vir2 >= vir3:
	if vir2 >= vir4:
		print(vir2)
	else:
		print(vir4)
elif vir3 >= vir4:
	print(vir3)
else:
	print(vir4)


arr = []
a = int(input())
arr.append(a)
b = int(input())
arr.append(b)
c = int(input())
arr.append(c)
if 1 in arr:
	if a == 1:
		if b == 1:
			if c == 1:
				print(a + b + c)
			else:
				print((a + b) * c)
		elif c == 1:
			print(a + b + c)
		else:
			print((a + b) * c)
	elif b == 1:
		if a < c:
			print((a + b) * c)
		else:
			print(a * (b + c))
	elif c == 1:
		print(a * (b + c))
else:
	print(int(a * b * c))


a = int(input())
b = int(input())
c = int(input())
vir1 = a * (b + c)
vir2 = a * b * c
vir3 = (a + b) * c
vir4 = a + b + c
print(max(vir1, vir2, vir3, vir4))


a = int(input())
b = int(input())
c = int(input())
num = []
num.append(a)
num.append(b)
num.append(c)
aa = max(num[0] + num[1], num[0] * num[1])
bb = max(num[1] + num[2], num[1] * num[2])
cc = max(aa * num[2], bb * num[0], aa + num[2], bb + num[0])
print(cc)


(a, b, c) = (int(input()), int(input()), int(input()))
list1 = [a * b * c, a + b + c, (a + b) * c, a * (b + c), a + b * c, a * b + c, a * b * c, a + b + c]
list1.sort()
print(list1[len(list1) - 1])


import math
import os
import sys
import re
import itertools
import functools
import operator
a = int(input())
b = int(input())
c = int(input())
print(max(a * b * c, a + b + c, a * (b + c), (a + b) * c, a * b + c, a + b * c))


a = int(input())
b = int(input())
c = int(input())
o1 = a * b * c
o2 = (a + b) * c
o3 = a * (b + c)
o4 = a + b + c
print(max([o1, o2, o3, o4]))


a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a)
l.append(b)
l.append(c)
ans = list()
ans.append((l[0] + l[1]) * l[2])
ans.append(l[0] + l[1] * l[2])
ans.append(l[0] * (l[1] + l[2]))
ans.append(l[0] * l[1] * l[2])
ans.append(l[0] + l[1] + l[2])
print(max(ans))


a = int(input())
b = int(input())
c = int(input())
total1 = a + b * c
total2 = a * (b + c)
total3 = a * b * c
total4 = (a + b) * c
total5 = a + b + c
ans = 0
if total1 >= total2 and total1 >= total3 and (total1 >= total4) and (total1 >= total5):
	ans = total1
elif total2 >= total1 and total2 >= total3 and (total2 >= total4) and (total2 >= total5):
	ans = total2
elif total3 >= total1 and total3 >= total2 and (total3 >= total4) and (total3 >= total5):
	ans = total3
elif total4 >= total1 and total4 >= total2 and (total4 >= total3) and (total4 >= total5):
	ans = total4
elif total5 >= total1 and total5 >= total2 and (total5 >= total3) and (total5 >= total4):
	ans = total5
print(ans)


a = int(input())
b = int(input())
c = int(input())
lst = []
s1 = (a + b) * c
s2 = a * (b + c)
s4 = a + b * c
s6 = c + a * b
s7 = a * b * c
s8 = a + b + c
lst.append(s1)
lst.append(s2)
lst.append(s4)
lst.append(s6)
lst.append(s7)
lst.append(s8)
print(max(lst))


l = 0
a = int(input())
if a == 1:
	l += 1
b = int(input())
if b == 1:
	l += 1
c = int(input())
if c == 1:
	l += 1
MAX = max(a, b, c)
MIN = min(a, b, c)
SRZ = 0
if MAX == a and MIN == b or (MAX == b and MIN == a):
	SRZ = c
elif MAX == a and MIN == c or (MAX == c and MIN == a):
	SRZ = b
elif MAX == b and MIN == c or (MAX == c and MIN == b):
	SRZ = a
if l == 1 and a == 1:
	print((a + b) * c)
elif l == 1 and c == 1:
	print(a * (b + c))
elif l == 1:
	print((1 + SRZ) * MAX)
elif l == 2 and a == 1 and (b == 1):
	print(MAX * 2)
elif l == 2 and (b == 1 and c == 1):
	print(MAX * 2)
elif l == 2:
	print(2 + MAX)
elif l == 3:
	print(3)
else:
	print(MAX * MIN * SRZ)


a = int(input())
b = int(input())
c = int(input())
p = a + b + c
q = a + b * c
s = a * b + c
t = (a + b) * c
x = a * b * c
y = a * (b + c)
z = max(p, q, s, t, x, y)
print(z)


def maximum():
	a = int(input())
	b = int(input())
	c = int(input())
	s1 = a + b + c
	s2 = a * b * c
	s3 = (a + b) * c
	s4 = a * (b + c)
	print(max(s1, s2, s3, s4))
maximum()


high = 0
(a, b, c) = (int(input()), int(input()), int(input()))
temp = a + b
high = max(temp * c, temp + c, high)
temp = a * b
high = max(temp * c, temp + c, high)
(a, c) = (c, a)
temp = a + b
high = max(temp * c, temp + c, high)
temp = a * b
high = max(temp * c, temp + c, high)
print(high)


def expression(a, b, c):
	a1 = a + b * c
	a2 = a * (b + c)
	a3 = a * b + c
	a4 = a * b * c
	a5 = a + b + c
	a6 = (a + b) * c
	return max(a1, a2, a3, a4, a5, a6)
a = int(input())
b = int(input())
c = int(input())
print(expression(a, b, c))


a = int(input())
b = int(input())
c = int(input())
z = []
z.append(a + b + c)
z.append(a * b * c)
z.append((a + b) * c)
z.append(a * (b + c))
z.append(a + b * c)
z.append(a * b + c)
z = sorted(z)
print(z[len(z) - 1])


(z, x, c) = (int(input()), int(input()), int(input()))
print(max((z + x) * c, z + x + c, z * (x + c), z * x * c))


(m, n, o) = (int(input()), int(input()), int(input()))
if m == 1 and n == 1 and (o == 1):
	print(3)
elif m == 1 and n == 1 or (n == 1 and o == 1):
	print(max([m, n, o]) * 2)
elif m == 1 and o == 1:
	print(m + n + o)
elif m == 1 or o == 1 or n == 1:
	print((n + min(m, o)) * max(m, o))
else:
	print(m * n * o)


import collections

def read():
	return input().strip()

def readInt():
	return int(input().strip())

def readList():
	return list(map(int, input().strip().split()))

def solve(a, b, c):
	return max(a + b + c, (a + b) * c, a * b + c, a + b * c, a * (b + c), a * b * c)
a = readInt()
b = readInt()
c = readInt()
print(solve(a, b, c))


ar = [0] * 5
a = int(input())
b = int(input())
c = int(input())
ar[0] = a + b * c
ar[1] = a * (b + c)
ar[2] = a * b * c
ar[3] = (a + b) * c
ar[4] = a + b + c
max = ar[0]
for i in range(1, 5):
	if max < ar[i]:
		t = max
		max = ar[i]
		ar[i] = t
print(max)


n = int(input())
m = int(input())
k = int(input())
a = n + m * k
b = n * (m + k)
c = n * m * k
d = (n + m) * k
e = n + m + k
f = n * m + k
t = [a, b, c, d, e, f]
max = t[0]
for i in range(len(t)):
	if t[i] > max:
		max = t[i]
print(max)


(a, b, c) = [int(input()) for i in ' ' * 3]
if a * c == 1:
	s = a + b + c
elif c == 1:
	s = a * (b + c)
elif a == 1:
	s = (a + b) * c
elif b == 1:
	s = max(a * (b + c), (a + b) * c)
else:
	s = a * b * c
print(s)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	if max(a, b, c) == b:
		if a == 1 and c == 1:
			print(a + b + c)
		elif a == 1 or c == 1:
			if (a + b) * c >= a * (b + c):
				print((a + b) * c)
			else:
				print(a * (b + c))
		elif a != 1 and c != 1:
			print(a * b * c)
	elif max(a, b, c) == a:
		ad = b + c
		pr = b * c
		if ad >= pr:
			print(ad * a)
		else:
			print(pr * a)
	elif max(a, b, c) == c:
		ad = a + b
		pr = a * b
		if ad >= pr:
			print(ad * c)
		else:
			print(pr * c)
main()


(a, b, c) = (int(input()), int(input()), int(input()))
jia = 'a+b+c'
chen = 'a*b*c'
jen = 'a+b*c'
chia = 'a*b+c'

def qwe(x):
	w = eval('(' + x[0:3] + ')' + x[3:5])
	q = eval(x)
	e = eval(x[0:2] + '(' + x[2:5] + ')')
	return max(q, w, e)
print(max(qwe(jia), qwe(chen), qwe(jen), qwe(chia)))


(a, b, c) = (int(input()), int(input()), int(input()))
mx = -1
mx = max(mx, a + b + c)
mx = max(mx, a * (b + c))
mx = max(mx, (a + b) * c)
mx = max(mx, a * b * c)
print(mx)


import sys

def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	ans = 0
	ans = max(ans, a + b + c)
	ans = max(ans, a * b + c)
	ans = max(ans, (a + b) * c)
	ans = max(ans, a * b * c)
	ans = max(ans, a + (b + c))
	ans = max(ans, a + b * c)
	ans = max(ans, a * (b + c))
	ans = max(ans, a * (b * c))
	print(ans)
solve()


a = int(input())
b = int(input())
c = int(input())
case_1 = a + b * c
case_2 = a * (b + c)
case_3 = a * b * c
case_4 = (a + b) * c
case_5 = a + b + c
print(max(case_1, case_2, case_3, case_4, case_5))


x = int(input())
y = int(input())
z = int(input())
k = list()
a = x + y * z
k.append(a)
b = x * (y + z)
k.append(b)
c = x * y * z
k.append(c)
d = (x + y) * z
k.append(d)
e = x + y + z
k.append(e)
f = x * y + z
k.append(f)
print(max(k))


a = list()
for i in range(3):
	a.append(int(input()))
sum = int()
if a[0] != 1 and a[1] != 1 and (a[2] != 1):
	sum = a[0] * a[1] * a[2]
elif a[0] == 1 and a[1] == 1 and (a[2] == 1):
	sum = a[0] + a[1] + a[2]
elif a[1] == 1 and a[0] > a[2]:
	sum = (a[2] + a[1]) * a[0]
elif a[1] == 1 and a[0] <= a[2]:
	sum = a[2] * (a[1] + a[0])
elif a[0] == 1 and a[2] == 1 and (a[1] != 1):
	sum = a[0] + a[1] + a[2]
elif a[0] == 1:
	sum = (a[0] + a[1]) * a[2]
elif a[2] == 1:
	sum = (a[1] + a[2]) * a[0]
print(sum)


(in0, in1, in2) = (int(input()), int(input()), int(input()))
lst0 = max([in0 + in1 + in2, in0 + in1 * in2, in0 * in1 * in2, (in0 + in1) * in2, in0 * (in1 + in2)])
print(lst0)


a = int(input())
b = int(input())
c = int(input())
m = 0
d = a * b + c
e = a * b * c
f = a * (b + c)
g = a + b * c
h = (a + b) * c
o = a + b + c
if d > m:
	m = d
if e > m:
	m = e
if f > m:
	m = f
if g > m:
	m = g
if h > m:
	m = h
if o > m:
	m = o
print(m)


a = int(input())
b = int(input())
c = int(input())
m = 0
m = max(m, a + b + c)
m = max(m, a * b + c)
m = max(m, a + b * c)
m = max(m, a * b * c)
m = max(m, a + b + c)
m = max(m, a * b + c)
m = max(m, (a + b) * c)
m = max(m, a * b * c)
m = max(m, a + (b + c))
m = max(m, a * (b + c))
m = max(m, a + b * c)
m = max(m, a * (b * c))
print(m)


a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a * b * c)
l.append((a + b) * c)
l.append(a * (b + c))
l.append(a + b + c)
p = l[0]
i = 1
while i < 4:
	if l[i] > p:
		p = l[i]
	i += 1
print(p)


a = int(input())
b = int(input())
c = int(input())
d = [0 for i in range(6)]
d[0] = a * b + c
d[1] = a * (b + c)
d[2] = a + b * c
d[3] = (a + b) * c
d[4] = a * b * c
d[5] = a + b + c
d.sort()
print(d[5])


a = int(input())
b = int(input())
c = int(input())
S1 = a + b + c
S2 = a + b * c
S3 = a * b + c
S4 = a * b * c
S5 = (a + b) * c
S6 = a * (b + c)
P = max(S1, S2, S3, S4, S5, S6)
print(P)


def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	r = [a + b * c, a * (b + c), a * b * c, a + b + c, (a + b) * c, a * b + c]
	print(max(r))
solve()


def Expression(a, b, c):
	ans = list()
	ans.append(a + b + c)
	ans.append(a + b * c)
	ans.append((a + b) * c)
	ans.append(a * b + c)
	ans.append(a * (b + c))
	ans.append(a * b * c)
	ans.sort()
	return ans.pop()
a = int(input())
b = int(input())
c = int(input())
print(Expression(a, b, c))


z = []
for _ in range(3):
	x = int(input())
	z.append(x)
a = z[0]
b = z[1]
c = z[2]
f = []
f.append(a + b + c)
f.append((a + b) * c)
f.append(a * b * c)
f.append(a * (b + c))
f.append(a + b * c)
f.append(a * b + c)
print(max(f))


a = int(input())
b = int(input())
c = int(input())
max = 0
t = []
t.append(int(a + b * c))
t.append(int(a * (b + c)))
t.append(int(a * b * c))
t.append(int((a + b) * c))
t.append(int(a + b + c))
s = t[0]
for i in range(1, len(t)):
	if s < t[i]:
		s = t[i]
print(s)


from functools import reduce
from operator import mul

def get_highest(numbers):
	if numbers == (1, 1, 1):
		return 3
	if numbers[0] == 1 and numbers[2] == 1:
		return sum(numbers)
	if numbers[0] == 1:
		combined = [numbers[0] + numbers[1], numbers[2]]
	elif numbers[1] == 1:
		if numbers[0] < numbers[2]:
			combined = [numbers[0] + numbers[1], numbers[2]]
		else:
			combined = [numbers[0], numbers[1] + numbers[2]]
	elif numbers[2] == 1:
		combined = [numbers[0], numbers[1] + numbers[2]]
	else:
		combined = numbers
	alt = reduce(mul, numbers, 1)
	ans = reduce(mul, combined, 1)
	if alt > ans:
		print(alt, '>', ans)
	return ans
a = int(input())
b = int(input())
c = int(input())
print(get_highest((a, b, c)))


a = int(input())
b = int(input())
c = int(input())
L = []
(L.append(a), L.append(b), L.append(c))
w = L[0] + L[1] + L[2]
x = (L[0] + L[1]) * L[2]
y = L[0] * (L[1] + L[2])
z = L[0] * L[1] * L[2]
L = []
(L.append(x), L.append(y), L.append(z), L.append(w))
L.sort()
L.reverse()
print(L[0])


a = int(input())
b = int(input())
c = int(input())
t = []
k = (a + b) * c
l = a * (b + c)
m = a + b * c
n = a * b * c
o = a * b + c
p = a + b + c
t.append(k)
t.append(l)
t.append(m)
t.append(n)
t.append(o)
t.append(p)
t.sort(reverse=True)
print(t[0])


l = []
m = []
for i in range(3):
	l.append(input())
m.append(eval('+'.join(l)))
m.append(eval('*'.join(l)))
m.append(eval('{}*({}+{})'.format(l[0], l[1], l[2])))
m.append(eval('({}+{})*{}'.format(l[0], l[1], l[2])))
m.append(eval('{}+{}*{}'.format(l[0], l[1], l[2])))
m.append(eval('{}*{}+{}'.format(l[0], l[1], l[2])))
print(max(m))


a = int(input())
b = int(input())
c = int(input())
pos_1 = a * b * c
pos_2 = a + b * c
pos_3 = a * (b + c)
pos_4 = a + b + c
pos_5 = (a + b) * c
list = []
list.append(pos_1)
list.append(pos_2)
list.append(pos_3)
list.append(pos_4)
list.append(pos_5)
list.sort()
print(list[4])


a = int(input())
b = int(input())
c = int(input())
l = a + b * c
m = a * (b + c)
n = a * b * c
o = (a + b) * c
q = a + b + c
print(max(l, m, n, o, q))


a = int(input())
b = int(input())
c = int(input())
if a > 1 and b > 1 and (c > 1):
	print(a * b * c)
if a == 1 and b > 1 and (c > 1):
	print((b + a) * c)
if a > 1 and b == 1 and (c > 1):
	if a > c:
		print(a * (b + c))
	else:
		print(c * (b + a))
if a == 1 and b == 1 and (c > 1):
	print(2 * c)
if a > 1 and b > 1 and (c == 1):
	print(a * (b + 1))
if a == 1 and b > 1 and (c == 1):
	print(b + 2)
if a > 1 and b == 1 and (c == 1):
	print(a * 2)
if a == 1 and b == 1 and (c == 1):
	print(3)


a = int(input())
b = int(input())
c = int(input())
if c != 1 and a != 1 and (b != 1):
	ans = a * b * c
else:
	ans = max(a * b * c, a + b + c, (a + b) * c, a + b * c, a * (b + c), a * b + c)
print(ans)


a = int(input())
b = int(input())
c = int(input())

def get_result(first_operation, second_operation, brackets):
	if brackets == 'first pair':
		tmp = a + b if first_operation == '+' else a * b
		return tmp + c if second_operation == '+' else tmp * c
	elif brackets == 'second pair':
		tmp = b + c if second_operation == '+' else b * c
		return tmp + a if first_operation == '+' else tmp * a
	elif first_operation == '*':
		tmp = a * b
		return tmp + c if second_operation == '+' else tmp * c
	elif second_operation == '*':
		return a + b * c
	else:
		return a + b + c
max_result = 0
for first_operation in ['+', '*']:
	for second_operation in ['+', '*']:
		for brackets in ['first pair', 'second pair', 'none']:
			max_result = max(max_result, get_result(first_operation, second_operation, brackets))
print(max_result)


a = int(input())
b = int(input())
c = int(input())
p = []
s1 = 0
s2 = 0
s3 = 0
s4 = 0
s5 = 0
s6 = 0
s7 = 0
s8 = 0
s9 = 0
s10 = 0
s11 = 0
s1 = a + b * c
p.append(s1)
s2 = a * (b + c)
p.append(s2)
s3 = a * b * c
p.append(s3)
s4 = (a + b) * c
p.append(s4)
s5 = b + c * a
p.append(s5)
s7 = (b + c) * a
p.append(s7)
s8 = c + a * b
p.append(s8)
s9 = c * (a + b)
p.append(s9)
s11 = c + a + b
p.append(s11)
p.sort()
l = len(p)
print(p[l - 1])


arr = [int(input()) for i in range(3)]
if arr.count(1) == 3:
	print(3)
elif arr.count(1) == 2:
	print(2 * max(arr)) if arr[1] == 1 else print(sum(arr))
elif arr[0] == 1:
	print((arr[0] + arr[1]) * arr[2])
elif arr[2] == 1:
	print(arr[0] * (arr[1] + arr[2]))
elif arr[1] == 1:
	print((arr[1] + min(arr[0], arr[2])) * max(arr[0], arr[2]))
else:
	print(arr[0] * arr[1] * arr[2])


from sys import stdin

def main():
	inp = stdin
	L = list()
	for i in range(3):
		dig = inp.readline().strip()
		L.append(dig)
	L = list(map(int, L))
	cont = 1
	fin = 0
	while cont != 5:
		if cont == 1:
			mayor = sum(L)
		elif cont == 2:
			mayor = L[0]
			for i in range(1, 3):
				mayor = mayor * L[i]
		elif cont == 3:
			mid = L[0:-1]
			suma = sum(mid)
			mayor = suma * L[-1]
		elif cont == 4:
			mid = L[1:]
			suma = sum(mid)
			mayor = suma * L[0]
		elif cont == 5:
			suma = L[0] + L[2]
			mayor = suma * L[1]
		cont += 1
		if mayor > fin:
			fin = mayor
	print(fin)
main()


def checker(array) -> int:
	a = array[0]
	b = array[1]
	c = array[2]
	if array.count(1) == 1 and array.index(1) == 0:
		print((a + b) * c)
	elif array.count(1) == 1 and array.index(1) == 2:
		print(a * (b + c))
	elif array.count(1) == 1 and array.index(1) == 1:
		if a + b < b + c:
			print((a + b) * c)
		else:
			print(a * (b + c))
	elif array.count(1) == 3:
		print(3)
	elif array.count(1) == 2:
		if array[0] == 1 and array[2] == 1:
			print(array[1] + 2)
		else:
			print(max(array) * 2)
	else:
		print(a * b * c)
checker([int(input()), int(input()), int(input())])


a = int(input())
b = int(input())
c = int(input())
liste = list()
liste.append(a + b + c)
liste.append(a + b * c)
liste.append(a * (b + c))
liste.append((a + b) * c)
liste.append(a * b * c)
print(max(liste))


import itertools
import math

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	print(max(a * b * c, a + b + c, a + b * c, a * b + c, a * (b + c), (a + b) * c))

def __starting_point():
	main()
__starting_point()


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
a = int(inp().strip())
b = int(inp().strip())
c = int(inp().strip())
m = max(a + b * c, a * (b + c), (a + b) * c, a * b + c, a * b * c, a + b + c)
out(str(m))


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	L = []
	L.append(a + b + c)
	L.append((a + b) * c)
	L.append(a * (b + c))
	L.append(a * c * b)
	print(max(L))
main()


a = int(input())
b = int(input())
c = int(input())
cur = ['(', ')', ')*', '*(', '+', '*']
ans = 0
for a1 in cur:
	for a2 in cur:
		for a3 in cur:
			for a4 in cur:
				try:
					ans = max(ans, eval(str(a1) + str(a) + str(a2) + str(b) + str(a3) + str(c) + str(a4)))
					ans = max(ans, eval(str(a1) + str(a) + str(a2) + str(b) + str(a3) + str(c)))
				except:
					pass
				try:
					ans = max(ans, eval(str(a1) + str(a) + str(a2) + str(b) + str(a3) + str(c)))
				except:
					pass
print(ans)


(n, m, k) = (int(input()) for i in range(3))
print(max(n + m + k, (n + m) * k, n * (m + k), n * m * k))


a = int(input())
b = int(input())
c = int(input())
results = []
results.append(a + b * c)
results.append(a * b + c)
results.append(a * b * c)
results.append(a + b + c)
results.append(a * (b + c))
results.append((a + b) * c)
print(max(results))


a = int(input())
b = int(input())
c = int(input())
e1 = a + b * c
e2 = (a + b) * c
e3 = a * b + c
e4 = a * (b + c)
e5 = a * b * c
e6 = a + b + c
li = []
li.append(e1)
li.append(e2)
li.append(e3)
li.append(e4)
li.append(e5)
li.append(e6)
print(max(li))


a = int(input())
b = int(input())
c = int(input())
my_l = []
my_l.append(a + b + c)
my_l.append(a * b * c)
my_l.append((a + b) * c)
my_l.append(a * (b + c))
print(max(my_l))


def expression(a, b, c):
	arr = [a * b * c, (a + b) * c, a * (b + c), a + b + c]
	print(max(arr))
a = input()
b = input()
c = input()
expression(int(a), int(b), int(c))


a = input()
b = input()
c = input()

def f1(a, b, c):
	return eval(a + '+' + b + '+' + c)

def f2(a, b, c):
	return eval(a + '*' + b + '*' + c)

def f3(a, b, c):
	return eval(a + '*' + b + '+' + c)

def f4(a, b, c):
	return eval(a + '+' + b + '*' + c)

def f5(a, b, c):
	return eval(a + '*(' + b + '+' + c + ')')

def f6(a, b, c):
	return eval('(' + a + '+' + b + ')*' + c)
print(max(f1(a, b, c), f2(a, b, c), f3(a, b, c), f4(a, b, c), f5(a, b, c), f6(a, b, c)))


a = int(input())
b = int(input())
c = int(input())
hasil1 = a + b * c
hasil2 = a * (b + c)
hasil3 = a * b * c
hasil4 = (a + b) * c
hasil5 = a + b + c
hasil = [hasil1, hasil2, hasil3, hasil4, hasil5]
for i in range(len(hasil)):
	for j in range(i + 1, len(hasil)):
		if hasil[i] <= hasil[j]:
			(hasil[i], hasil[j]) = (hasil[j], hasil[i])
for i in range(len(hasil)):
	print(hasil[0])
	break


a = int(input())
b = int(input())
c = int(input())
ans = []
ans.append(a + b + c)
ans.append(a + b * c)
ans.append(a * b + c)
ans.append(a * b * c)
ans.append((a + b) * c)
ans.append(a * (b + c))
ans.sort()
print(ans[-1])


a = int(input())
b = int(input())
c = int(input())
pp = a + b + c
pm = (a + b) * c
mp = a * (b + c)
mm = a * b * c
my_vec = max(pp, pm, mp, mm)
print(my_vec)


w = int(input())
x = int(input())
v = int(input())
er = 0
if w + x + v > er:
	er = w + x + v
if w * x * v > er:
	er = w * x * v
if w + x * v > er:
	er = w + x * v
if (w + x) * v > er:
	er = (w + x) * v
if w * x + v > er:
	er = w * x + v
if w * (x + v) > er:
	er = w * (x + v)
print(er)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	if a == b == c == 1 or a == c == 1:
		ans = a + b + c
	elif a == 1:
		ans = (b + 1) * c
	elif b == 1:
		ans = max((a + 1) * c, (c + 1) * a)
	elif c == 1:
		ans = a * (b + 1)
	else:
		ans = a * b * c
	print(ans)
t = 1
for _ in range(t):
	main()


raw = []
s = 0
for i in range(3):
	raw.append(int(input()))
if raw[0] == 1:
	if raw[2] != 1:
		s = (raw[0] + raw[1]) * raw[2]
	else:
		s = raw[1] + 2
elif raw[1] == 1:
	s = (min(raw[0], raw[2]) + 1) * max(raw[0], raw[2])
elif raw[2] == 1:
	s = (raw[1] + 1) * raw[0]
else:
	s = raw[0] * raw[1] * raw[2]
print(s)


a = int(input())
b = int(input())
c = int(input())
v = a + b + c
v1 = (a + b) * c
v2 = a * (b + c)
v3 = a * b * c
print(max(v, v1, v2, v3))


l = []
l.append(int(input()))
l.append(int(input()))
l.append(int(input()))
m = l[0] + l[1] * l[2]
m1 = l[0] * (l[1] * l[2])
m2 = l[0] * l[1] * l[2]
m3 = l[0] * l[1] * l[2]
m4 = (l[0] + l[1]) * l[2]
m5 = l[0] + l[1] + l[2]
m6 = l[0] * (l[1] + l[2])
print(max(m, m1, m2, m3, m4, m5, m6))


a = int(input())
b = int(input())
c = int(input())
result = 0
result = max(max(max(a + b * c, a * (b + c)), max(a * b * c, (a + b) * c)), max(a * b + c, a + b + c))
print(result)


def maxes(a, b, c):
	maxy = 0
	maxy = max(a + b * c, a * b * c, (a + b) * c, a + b + c, a * (b + c))
	return print(maxy)
a = int(input())
b = int(input())
c = int(input())
maxes(a, b, c)


a = int(input())
b = int(input())
c = int(input())
k = 1
for j in range(0, 5, 1):
	if k == 1:
		w = a + b * c
		k = k + 1
	elif k == 2:
		j = a * (b + c)
		k = k + 1
		h = (a + b) * c
		if j <= h:
			x = h
		else:
			x = j
	elif k == 3:
		y = a * b + c
		k = k + 1
	elif k == 4:
		z = a * b * c
		k = k + 1
	elif k == 5:
		l = a + b + c
if l > w:
	if l > x:
		if l > y:
			if l > z:
				print(l)
			else:
				print(z)
		elif y > z:
			print(y)
		else:
			print(z)
	elif x > y:
		if x > z:
			print(x)
		else:
			print(z)
	elif y > z:
		print(y)
	else:
		print(z)
elif w > x:
	if w > y:
		if w > z:
			print(w)
		else:
			print(z)
	elif y > z:
		print(y)
	else:
		print(z)
elif x > y:
	if x > z:
		print(x)
	else:
		print(z)
elif y > z:
	print(y)
else:
	print(z)


l = int(input())
m = int(input())
n = int(input())
a = l + m * n
b = l + m + n
c = l * m + n
d = l * m * n
e = l * (m + n)
f = (l + m) * n
print(max(a, b, c, d, e, f))


a = int(input())
b = int(input())
c = int(input())
p = a + b
q = a * b
r = b + c
s = b * c
x = []
x.append(p + c)
x.append(p * c)
x.append(q + c)
x.append(q * c)
x.append(a + r)
x.append(a * r)
x.append(a + s)
x.append(a * s)
print(max(x))


(a, b, c) = (int(input()), int(input()), int(input()))
l = []
l.append(a)
l.append(b)
l.append(c)
l2 = []
c = l[0] + l[1] * l[2]
d = l[0] * (l[1] + l[2])
e = l[0] * l[1] * l[2]
f = (l[0] + l[1]) * l[2]
g = l[0] + l[1] + l[2]
l2.append(c)
l2.append(d)
l2.append(e)
l2.append(f)
l2.append(g)
print(max(l2))


a = int(input())
b = int(input())
c = int(input())
l = []
k = max(a * b + c, a * b * c, (a + b) * c, a + b + c, a + (b + c), a + b * c, a * (b + c))
print(k)


a = int(input())
b = int(input())
c = int(input())
arr = []
arr.append(a + b * c)
arr.append(a * (b + c))
arr.append(a * b * c)
arr.append((a + b) * c)
arr.append(a + b + c)
arr.sort()
print(arr[4])


a = str(input())
b = str(input())
c = str(input())
mm = 0
for i in range(2):
	n1 = b
	if i == 0:
		n2 = a
		n3 = c
	else:
		n2 = c
		n3 = a
	for j in range(2):
		if j == 0:
			n = str(eval(n1 + '+' + n2))
		else:
			n = str(eval(n1 + '*' + n2))
		m = max(eval(n + '*' + n3), eval(n + '+' + n3))
		if m > mm:
			mm = m
print(mm)


f = int(input())
b = int(input())
c = int(input())
print(max(f * b * c, f + b * c, f * b + c, (f + b) * c, f * (b + c), f + b + c))


a = int(input())
b = int(input())
c = int(input())
maximum = []
maximum.append(int(a + b + c))
maximum.append(int(a * b * c))
maximum.append(int((a + b) * c))
maximum.append(int(a * (b + c)))
ma = 0
for i in maximum:
	ma = max(ma, i)
print(ma)


from itertools import permutations
a = int(input())
b = int(input())
c = int(input())
ans = max(a + b + c, a * b * c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a + b * c)
ans = max(ans, a * b + c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
x1 = a * b * c
x2 = (a + b) * c
x3 = (b + c) * a
x4 = a + b + c
z = []
z.append(x1)
z.append(x2)
z.append(x3)
z.append(x4)
for i in (0, 4):
	v = max(z)
print(v)


s = int(input())
a = int(input())
i = int(input())
h = s + a * i
u = s * (a + i)
v = s * a * i
t = (s + a) * i
x = s + a + i
print(max(h, u, v, t, x))


def fun(a, b, c):
	li = list()
	li.append(a * b * c)
	li.append(a * b + c)
	li.append(a * (b + c))
	li.append(a + b * c)
	li.append((a + b) * c)
	li.append(a + b + c)
	print(max(li))
a = int(input())
b = int(input())
c = int(input())
fun(a, b, c)


a = int(input())
b = int(input())
c = int(input())
resf = []
res = 0
for i in range(5):
	if i == 0:
		res = a + b * c
		resf.append(res)
	elif i == 1:
		res = a * (b + c)
		resf.append(res)
	elif i == 2:
		res = a * b * c
		resf.append(res)
	elif i == 3:
		res = (a + b) * c
		resf.append(res)
	elif i == 4:
		res = a + b + c
		resf.append(res)
	res = 0
resf.sort()
print(resf[-1])


a = int(input())
b = int(input())
c = int(input())
n1 = a + b + c
n2 = (a + b) * c
n3 = a * (b + c)
n4 = a * b * c
list = [n1, n2, n3, n4]
print(max(list))


list1 = []
a = int(input())
list1.append(a)
b = int(input())
list1.append(b)
c = int(input())
list1.append(c)
result = 0
if a == 1 and b == 1 and (c == 1) or (a == 1 and c == 1):
	print(a + b + c)
elif a == 1 and b == 1 or (b == 1 and c == 1):
	print(2 * max(a, c))
elif a == 1 or c == 1:
	print((1 + b) * max(a, c))
elif b == 1:
	print((1 + min(a, c)) * max(a, c))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
s = sum(l)
p = a * b * c
e1 = (a + b) * c
e2 = a * (b + c)
print(max(s, p, e1, e2))


c = int(input())
c1 = int(input())
c2 = int(input())
print(max([c + c1 + c2, c + c1 * c2, c * c1 + c2, c * (c2 + c1), (c + c1) * c2, c * c1 * c2]))


a = int(input(''))
b = int(input(''))
c = int(input(''))
g = 0
if a * b * c > a + b * c:
	g = a * b * c
else:
	g = a + b * c
if g < a * (b + c):
	g = a * (b + c)
if g < (a + b) * c:
	g = (a + b) * c
elif g < a + b + c:
	g = a + b + c
print(g)


a = int(input())
b = int(input())
c = int(input())
t = []
x = a + b + c
t.append(x)
x = (a + b) * c
t.append(x)
x = a + b * c
t.append(x)
x = a * (b + c)
t.append(x)
x = a * b + c
t.append(x)
x = a * b * c
t.append(x)
print(max(t))


from sys import stdin, maxsize
(lines, line_index) = (stdin.readlines(), -1)

def get_line():
	global lines, line_index
	line_index += 1
	return lines[line_index]

def main():
	a = int(get_line())
	b = int(get_line())
	c = int(get_line())
	ans = max([(a + b) * c, a * (b + c), a * c + c, a + b * c, a + b + c, a * b * c])
	print(ans)
main()


a = int(input())
b = int(input())
c = int(input())
x1 = a + b * c
x2 = a * (b + c)
x3 = a * b * c
x4 = (a + b) * c
x5 = a + b + c
ls = [x1, x2, x3, x4, x5]
ls.sort()
print(ls[-1])


a = int(input())
b = int(input())
c = int(input())
q = a + b + c
w = a + b * c
w1 = (a + b) * c
e = a * b + c
e1 = a * (b + c)
r = a * b * c
print(max(q, w, w1, e, e1, r))


a = int(input())
b = int(input())
c = int(input())
r1 = a + b + c
r2 = a * b + c
r3 = a + b * c
r5 = a * b * c
r6 = (a + b) * c
r8 = (b + c) * a
print(max(r1, r2, r3, r5, r6, r8))


import sys
from random import choice, randint
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, sys.stdin.readline().strip().split())

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().strip().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def LS():
	return sys.stdin.readline().strip().split()

def I():
	return int(sys.stdin.readline().strip())

def F():
	return float(sys.stdin.readline().strip())

def S():
	return sys.stdin.readline().strip()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	a = I()
	b = I()
	c = I()
	pf(max([a + b * c, a * (b + c), a * (b * c), (a + b) * c, a + b + c]))
main()


(a, b, c) = [int(input()) for i in '123']
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


(a, b, c) = [input() for i in '___']
print(max([eval(i.format(a, b, c)) for i in ['{}+{}+{}', '{}*{}*{}', '{}+{}*{}', '{}*{}+{}', '({}+{})*{}', '{}*({}+{})']]))


(a, b, c) = [int(input()) for i in 'abc']
w = a * b * c
x = a * (b + c)
y = (a + b) * c
z = a + b + c
if w >= x and w >= y and (w >= z):
	print(w)
elif x >= w and x >= y and (x >= z):
	print(x)
elif y >= w and y >= x and (y >= z):
	print(y)
else:
	print(z)


def input_int():
	return int(input())

def input_str():
	return str(input())
a = input_int()
b = input_int()
c = input_int()
print(max(a * b * c, a + b + c, (a + b) * c, (b + c) * a))


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = (a + b) * c
z = a + b * c
j = a * (b + c)
k = a * b + c
l = a * b * c
print(max(x, y, z, j, k, l))


import array as arr
a = int(input())
b = int(input())
c = int(input())
p = arr.array('i', [a * b + c, a + b * c, a * (b + c), (a + b) * c, a + b + c, a * b * c])
print(max(p))


import math
a = int(input())
n = int(input())
c = 0
b = int(input())
i = 0
j = 0
if a * n * b > c:
	c = a * n * b
if a + n + b > c:
	c = a + n + b
if (a + n) * b > c:
	c = (a + n) * b
if a * (n + b) > c:
	c = a * (n + b)
print(c)


def func(a, b, c):
	if a > 1 and b > 1 and (c > 1):
		return a * b * c
	elif a == 1:
		return max((b + 1) * c, 1 + b + c)
	elif c == 1:
		return max(a * (b + 1), a + b + 1)
	elif b == 1:
		return max(a + b + c, (a + 1) * c, a * (c + 1))
a = int(input())
b = int(input())
c = int(input())
print(func(a, b, c))


a = int(input())
b = int(input())
c = int(input())
imax = 0
k = a + b * c
l = a * (b + c)
m = a * b * c
n = (a + b) * c
o = a + b + c
print(max(k, l, m, n, o))


withFile = 0
if withFile == 1:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')

def getl():
	if withFile == 0:
		return input()
	else:
		return fin.readline()

def printl(s):
	if withFile == 0:
		print(s)
	else:
		fout.write(str(s))

def get_arr():
	x = getl().split(' ')
	if x[-1] == '':
		x = x[:-1]
	return list(map(int, x))
mx = 0
(a, b, c) = (get_arr()[0], get_arr()[0], get_arr()[0])
mx = (a + b) * c
mx = max(mx, a * (b + c))
mx = max(mx, a * b * c)
mx = max(mx, a + b + c)
printl(str(mx))
if withFile == 1:
	fin.close()
	fout.close()


(a, b, c) = [int(input()) for i in range(3)]
fl = [lambda a, b, c: a + b + c, lambda a, b, c: a + b * c, lambda a, b, c: (a + b) * c, lambda a, b, c: a * b + c, lambda a, b, c: a * (b + c), lambda a, b, c: a * b * c]
v = [f(a, b, c) for f in fl]
print(max(v))


def maxexp(a, b, c):
	if a == b == c == 1:
		print(3)
	elif a == 1 or c == 1 or b == 1:
		print(max((a + b) * c, a * (b + c), a + b + c))
	else:
		print(a * b * c)
a = int(input())
b = int(input())
c = int(input())
maxexp(a, b, c)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
s = sorted(l)
if 1 not in l:
	print(a * b * c)
elif l.count(1) == 1:
	if b == 1:
		print((b + s[1]) * s[2])
	else:
		print((1 + b) * c if a == 1 else (1 + b) * a)
elif a != 1 or c != 1:
	print(2 * s[-1])
else:
	print(a + b + c)


a = int(input())
b = int(input())
c = int(input())
if 1 < a and 1 < b and (1 < c):
	ans = a * b * c
elif a == b == c == 1:
	ans = 3
elif b == 1:
	ans = (min(a, c) + b) * max(a, c)
elif a == 1:
	ans = a + b
	ans = ans * c if c > 1 else ans + c
elif c == 1:
	ans = b + c
	ans = ans * a if a > 1 else ans + a
print(ans)


a = int(input())
b = int(input())
c = int(input())
result_1 = a * b * c
result_2 = a + b * c
result_3 = a + b + c
result_4 = a * b + c
result_5 = (a + b) * c
result_6 = a * (b + c)
print(max(result_6, result_5, result_4, result_3, result_2, result_1))


a = int(input())
b = int(input())
c = int(input())
abc = []
abc.append((a + b) * c)
abc.append(a * (b + c))
abc.append(a + b + c)
abc.append(a * b * c)
print(max(abc))


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
if 1 not in l:
	t = l[0] * l[1] * l[2]
elif l.count(1) == 3:
	t = 3
elif l.count(1) == 2:
	if l[1] != 1:
		t = sum(l)
	else:
		t = 2 * max(l)
elif l[1] == 1:
	t = (min(l[0], l[2]) + 1) * max(l)
elif l[0] == 1:
	t = (1 + l[1]) * l[2]
else:
	t = (1 + l[1]) * l[0]
print(t)


a = int(input())
b = int(input())
c = int(input())
result = (a + b) * c
sum1 = a + b * c
sum2 = a * (b + c)
sum3 = a * b * c
sum4 = (a + b) * c
sum5 = a + b + c
sum6 = a * b + c
print(max(sum1, sum2, sum3, sum4, sum5, sum6))


def GetMax(n1, n2, n3):
	maxSum = 0
	sum1 = n1 + n2 + n3
	sum2 = (n1 + n2) * n3
	sum3 = n1 * (n2 + n3)
	sum4 = n1 * n2 * n3
	if sum2 > sum1:
		maxSum = sum2
	else:
		maxSum = sum1
	if maxSum < sum3:
		maxSum = sum3
	if maxSum < sum4:
		maxSum = sum4
	return maxSum
n1 = int(input())
n2 = int(input())
n3 = int(input())
arr = []
print(GetMax(n1, n2, n3))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	a = I()
	b = I()
	c = I()
	r = []
	r.append(a * b * c)
	r.append((a + b) * c)
	r.append(a * (b + c))
	r.append(a + b + c)
	return max(r)
print(main())


x = int(input())
y = int(input())
z = int(input())
max = 0
if x + y + z > max:
	max = x + y + z
if (x + y) * z > max:
	max = (x + y) * z
if x * y * z > max:
	max = x * y * z
if x + y * z > max:
	max = x + y * z
if x * (y + z) > max:
	max = x * (y + z)
if x * y + z > max:
	max = x * y + z
print(max)


def get():
	return [int(x) for x in input().split()]
(a, b, c) = (int(input()), int(input()), int(input()))
print(max(a + b + c, (a + b) * c, a * (b + c), a * b * c))


import math
val = []
a = int(input())
b = int(input())
c = int(input())
val.append(a + b * c)
val.append(a * (b + c))
val.append(a * b * c)
val.append((a + b) * c)
val.append(a + b + c)
print(max(val))


def solve(a, b, c):
	(m1, m2) = (0, 0)
	m1 = max(a + b * c, a * (b + c), a * b * c, (a + b) * c)
	m2 = max(a + b + c, a * b * c)
	return max(m1, m2)
x = int(input())
y = int(input())
z = int(input())
print(solve(x, y, z))


def fun():
	a = int(input())
	b = int(input())
	c = int(input())
	print(max([a * b * c, (a + b) * c, a + b * c, a * b + c, a * (b + c), a + b + c]))
fun()


(n, m) = (int, input)
a = n(m())
b = n(m())
c = n(m())
x = [a + b + c, a * b * c, (a + b) * c, a * (b + c), a + b * c, a * b + c]
print(max(x))


k = []
for i in range(0, 3):
	n = int(input())
	k.append(n)
a = (k[0] + k[1]) * k[2]
b = (k[1] + k[2]) * k[0]
c = k[0] * k[1] * k[2]
d = k[0] + k[1] + k[2]
print(max(a, b, c, d))


from functools import reduce
a = int(input())
b = int(input())
c = int(input())
nums = []
nums.append(a)
nums.append(b)
nums.append(c)
if 1 not in nums:
	print(reduce(lambda x, y: x * y, nums))
elif nums.count(1) == 3:
	print(3)
elif nums.count(1) == 2:
	if nums[1] == max(nums):
		print(sum(nums))
	else:
		print(2 * max(nums))
elif nums[0] == 1:
	print((nums[1] + 1) * nums[2])
elif nums[2] == 1:
	print((nums[1] + 1) * nums[0])
else:
	print((sorted(nums)[1] + 1) * sorted(nums)[2])


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	if a == 1 and c == 1:
		print(a + b + c)
	elif a == 1:
		print((a + b) * c)
	elif c == 1:
		print(a * (b + c))
	elif b == 1:
		print((min(a, c) + b) * max(a, c))
	else:
		print(a * b * c)
main()


a = int(input())
b = int(input())
c = int(input())
l = []
m = int(a * b + c)
n = int(a * (b + c))
o = int(a * b * c)
p = int((a + b) * c)
q = int(a + b + c)
l.append(m)
l.append(n)
l.append(o)
l.append(p)
l.append(q)
l.sort()
print(l[4])


a = int(input())
b = int(input())
c = int(input())
sols = []
sols.append(a + b * c)
sols.append(a * (b + c))
sols.append(a * b * c)
sols.append((a + b) * c)
sols.append(a + b + c)
print(max(sols))


a = int(input())
b = int(input())
c = int(input())
t1 = a * b * c
t2 = (a + b) * c
t3 = a * (b + c)
t4 = a + b + c
print(int(max(t1, t2, t3, t4)))


q = []
m = input()
n = input()
o = input()
a = int(m)
b = int(n)
c = int(o)
d = a * b + c
e = a + b + c
f = a * b * c
g = a + b * c
h = a * (b + c)
i = (a + b) * c
q.append(d)
q.append(e)
q.append(f)
q.append(g)
q.append(h)
q.append(i)
print(max(q))


arr = []
for i in range(3):
	arr.append(int(input()))
ans = -1
ans = max(ans, max(arr[0] + arr[1] + arr[2], max(arr[0] + arr[1] * arr[2], max(arr[0] * arr[1] + arr[2], max(arr[0] * arr[1] * arr[2], max((arr[0] + arr[1]) * arr[2], arr[0] * (arr[1] + arr[2])))))))
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = []
d.append(a + b * c)
d.append(a * (b + c))
d.append(a * b * c)
d.append((a + b) * c)
d.append(a + b + c)
max = d[0]
for i in range(0, 5):
	if d[i] > max:
		max = d[i]
print(max)


x = int(input())
y = int(input())
z = int(input())
sums = []
sums.append(x + y + z)
sums.append(x * y * z)
sums.append(x + y * z)
sums.append(x * y + z)
sums.append((x + y) * z)
sums.append(x * (y + z))
large = sums[0]
for i in sums:
	if i >= large:
		large = i
print(large)


(x, y, z) = (int(input()), int(input()), int(input()))
maxm = -1
if x + y + z > maxm:
	maxm = x + y + z
if x + y * z > maxm:
	maxm = x + y * z
if (x + y) * z > maxm:
	maxm = (x + y) * z
if x * y + z > maxm:
	maxm = x * y + z
if x * (y + z) > maxm:
	maxm = x * (y + z)
if x * y * z > maxm:
	maxm = x * y * z
print(maxm)


def diff_modes(num1, num2, num3):
	mode = [0, 0, 0, 0, 0, 0]
	mode[0] = num1 + num2 + num3
	mode[1] = (num1 + num2) * num3
	mode[2] = num1 + num2 * num3
	mode[3] = num1 * num2 * num3
	mode[4] = num1 * num2 + num3
	mode[5] = num1 * (num2 + num3)
	return mode
a = int(input())
b = int(input())
c = int(input())
modes = diff_modes(a, b, c)
print(max(modes))


num1 = int(input())
num2 = int(input())
num3 = int(input())
if num1 == 1:
	result = max((num1 + num2) * num3, num1 + num2 + num3)
elif num2 == 1:
	result = max(num1 * (num2 + num3), (num1 + num2) * num3, num1 + num2 + num3)
elif num3 == 1:
	result = max(num1 * (num2 + num3), num1 + num2 + num3)
else:
	result = num1 * num2 * num3
print(result)


l = []
a = int(input())
b = int(input())
c = int(input())
sum_1 = a + b * c
l.append(sum_1)
sum_2 = a * (b + c)
l.append(sum_2)
sum_3 = a * b * c
l.append(sum_3)
sum_4 = (a + b) * c
l.append(sum_4)
sum_5 = a + b + c
l.append(sum_5)
print(max(l))


import sys
a = int(input())
b = int(input())
c = int(input())
print(max(a + b * c, a * b + c, a + b + c, a * b * c, a * (b + c), (a + b) * c))


def opsMax(l):
	result = []
	result.append(l[0] + l[1] + l[2])
	result.append(l[0] * l[1] * l[2])
	result.append(l[0] + l[1] * l[2])
	result.append(l[0] * l[1] + l[2])
	result.append((l[0] + l[1]) * l[2])
	result.append(l[0] * (l[1] + l[2]))
	return max(result)
x = []
for i in range(3):
	x.append(int(input()))
print(opsMax(x))


a = input()
b = input()
c = input()
allvars = []
a1 = int(a)
b1 = int(b)
c1 = int(c)
var1 = a1 + b1 + c1
var2 = a1 + b1 * c1
var3 = a1 * b1 + c1
var4 = a1 * b1 * c1
var5 = (a1 + b1) * c1
var6 = a1 * (b1 + c1)
allvars.append(var1)
allvars.append(var2)
allvars.append(var3)
allvars.append(var4)
allvars.append(var5)
allvars.append(var6)
print(max(allvars))


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = a * (b + c)
f = a * b * c
g = (a + b) * c
s = a + b + c
k = max(d, e, f, g, s)
print(k)


arr = []
for _ in range(3):
	arr.append(int(input().strip()))
print(max(sum(arr), sum(arr[:2]) * arr[2], arr[0] * sum(arr[1:]), eval('*'.join((str(i) for i in arr)))))


a = int(input())
b = int(input())
c = int(input())
lx = list()
lx.append(a + b * c)
lx.append(a * (b + c))
lx.append(a * b * c)
lx.append((a + b) * c)
lx.append(a + b + c)
lx.sort()
print(lx[-1])


nos = []
for i in range(3):
	no = int(input())
	nos.append(no)
a = nos[0] + nos[1] + nos[2]
b = nos[0] * nos[1] * nos[2]
c = nos[0] * nos[1] + nos[2]
d = nos[0] * (nos[1] + nos[2])
e = nos[0] + nos[1] * nos[2]
f = (nos[0] + nos[1]) * nos[2]
lists = [a, b, c, d, f, e]
print(max(lists))


def equation(a, b, c):
	lst = [a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c]
	return max(lst)
A = int(input())
B = int(input())
C = int(input())
print(equation(A, B, C))


x = [0, 0, 0]
for i in range(3):
	x[i] = int(input())
possVal = [sum(x), x[0] * x[1] * x[2], x[0] + x[1] * x[2], x[0] * x[1] + x[2], (x[0] + x[1]) * x[2], x[0] * (x[1] + x[2])]
print(max(possVal))


a = int(input())
b = int(input())
c = int(input())
m1 = max(a + b + c, a * b * c)
m2 = max((a + b) * c, a * (b + c))
print(max(m1, m2))


a = int(input())
b = int(input())
c = int(input())
l = [1, 1, 1, 1]
l[0] = (a + b) * c
l[1] = a + b + c
l[2] = a * (b + c)
l[3] = a * b * c
max = 0
for x in l:
	if max <= x:
		max = x
print(max)


x = int(input())
y = int(input())
z = int(input())
li = []
li.append(x + y * z)
li.append(x * (y + z))
li.append(x * y * z)
li.append((x + y) * z)
li.append(x + y + z)
print(max(li))


import sys
a = int(input())
b = int(input())
c = int(input())
r1 = a + b + c
r2 = (a + b) * c
r3 = a * b * c
r4 = a * b + c
r5 = a + (b + c)
r6 = a + b * c
r7 = a * (b * c)
r8 = a * (b + c)
answers = [r1, r2, r3, r4, r5, r6, r7, r8]
print(max(answers))


a = int(input())
b = int(input())
c = int(input())
answer = a + b * c
answer2 = a * (b + c)
answer3 = a * b * c
answer4 = (a + b) * c
answer5 = a + b + c
x = [answer, answer2, answer3, answer4, answer5]
x.sort()
print(x[4])


a = int(input())
b = int(input())
c = int(input())
y1 = a + b + c
y2 = a * b * c
y3 = (a + b) * c
y4 = a * (b + c)
y5 = a + b * c
y6 = a * b + c
print(max(y1, y2, y3, y4, y5, y6))


a = int(input())
b = int(input())
c = int(input())
listy = []
r1 = a + b * c
listy.append(r1)
r2 = a * b + c
listy.append(r2)
r3 = a * b * c
listy.append(r3)
r4 = a * (b + c)
listy.append(r4)
r5 = (a + b) * c
listy.append(r5)
r6 = a + b + c
listy.append(r6)
now = max(listy)
print(now)


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = a * (b + c)
z = (a + b) * c
q = a * b * c
f = max(x, y, z, q)
print(f)


a = int(input())
b = int(input())
c = int(input())
d = []
if a == 1 or b == 1 or c == 1:
	d.append(a)
	d.append(b)
	d.append(c)
	c1 = 0
	for i in range(len(d)):
		if d[i] == 1:
			c1 += 1
	if c1 == 3:
		print(3)
	elif c1 == 2:
		if d[0] == 1 and d[1] == 1:
			f = (d[0] + d[1]) * d[2]
			print(f)
		elif d[1] == 1 and d[2] == 1:
			f = (d[1] + d[2]) * d[0]
			print(f)
		else:
			print(a + b + c)
	elif a == 1:
		d = (a + b) * c
		print(d)
	elif b == 1:
		if a < c:
			d = (a + b) * c
			print(d)
		else:
			d = (b + c) * a
			print(d)
	elif c == 1:
		d = (c + b) * a
		print(d)
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
mas = [(a + b) * c, a * (b + c), a + b + c, a * b * c]
mas.sort()
print(mas[-1])


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
w = (a + b) * c
k = a + b + c
m = a * b + c
list1 = []
list1.append(x)
list1.append(y)
list1.append(z)
list1.append(w)
list1.append(k)
list1.append(m)
print(max(list1))


a = int(input())
b = int(input())
c = int(input())

def give(a, b, c):
	if a == 1 and c != 1:
		print((a + b) * c)
		return
	elif c == 1 and a != 1:
		print(a * (b + c))
		return
	elif a == 1 and c == 1:
		print(a + b + c)
		return
	elif b == 1:
		print(max((a + b) * c, a * (b + c)))
		return
	else:
		print(a * b * c)
		return
give(a, b, c)


a = int(input())
b = int(input())
c = int(input())
Result = []
Result.append(a + b + c)
Result.append(a + b * c)
Result.append(a * b + c)
Result.append(a * b * c)
Result.append((a + b) * c)
Result.append(a * (b + c))
print(str(max(Result)))


def cmp(a, b):
	return a if a >= b else b
a = int(input())
b = int(input())
c = int(input())
max = a + b + c
max = cmp(a * b * c, max)
max = cmp(a + b * c, max)
max = cmp(a * b + c, max)
max = cmp((a + b) * c, max)
max = cmp(a * (b + c), max)
print(max)


a = int(input())
b = int(input())
c = int(input())
k = a + b + c
l = a * b * c
m = (a + b) * c
n = a * (b + c)
s = [k, l, m, n]
max(s)
print(max(s))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and c == 1:
	m = a + b + c
elif a == 1:
	m = (a + b) * c
elif c == 1:
	m = (b + c) * a
elif b == 1:
	if a > c:
		m = (c + b) * a
	else:
		m = (a + b) * c
else:
	m = a * b * c
print(m)


a = int(input())
b = int(input())
c = int(input())
ans = -1
ans = max(ans, a + b + c)
ans = max(ans, a + b * c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * b + c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
print(ans)


n1 = int(input())
n2 = int(input())
n3 = int(input())
x = []
x.append(n1 + n2 + n3)
x.append(n1 * (n2 + n3))
x.append(n1 * n2 * n3)
x.append((n1 + n2) * n3)
print(max(x))


a = int(input())
b = int(input())
c = int(input())
num = 0
if a == 1 and b != 1 and (c != 1):
	if b > c:
		num = (a + b) * c
	else:
		num = (b + a) * c
elif b == 1 and a != 1 and (c != 1):
	if a > c:
		num = (b + c) * a
	else:
		num = (b + a) * c
elif c == 1 and a != 1 and (b != 1):
	if a > b:
		num = (b + c) * a
	else:
		num = (c + b) * a
elif a == 1 and b == 1 and (c != 1):
	num = (a + b) * c
elif a == 1 and c == 1 and (b != 1):
	num = a + c + b
elif b == 1 and c == 1 and (a != 1):
	num = (c + b) * a
elif a == 1 and b == 1 and (c == 1):
	num = a + b + c
else:
	num = a * b * c
print(num)


k = []
for i in range(3):
	n = int(input())
	k.append(n)
j = []
j.append(k[0] + k[1] * k[2])
j.append(k[0] * (k[1] + k[2]))
j.append(k[0] * k[1] * k[2])
j.append((k[0] + k[1]) * k[2])
j.append(k[0] + k[1] + k[2])
print(max(j))


a = int(input())
b = int(input())
c = int(input())
nums = [a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c]
nums.sort()
print(nums[-1])


a = int(input())
b = int(input())
c = int(input())
if a == 1 and c == 1:
	s = 2 + b
else:
	s_1 = a + b * c
	s_2 = a * b + c
	s_3 = a * (b + c)
	s_4 = (a + b) * c
	s_5 = a * b * c
	s = max(s_1, s_2, s_3, s_4, s_5)
print(s)


a = int(input())
b = int(input())
c = int(input())
maximum = 0
maximum = max(maximum, a + b + c)
maximum = max(maximum, a + b * c)
maximum = max(maximum, (a + b) * c)
maximum = max(maximum, a * b + c)
maximum = max(maximum, a * (b + c))
maximum = max(maximum, a * b * c)
print(maximum)


def exp(a, b, c):
	l = []
	l.append(a + b + c)
	l.append(a * b * c)
	l.append((a + b) * c)
	l.append(a + b * c)
	l.append(a * b + c)
	l.append(a * (b + c))
	l.sort()
	return l[-1]
a = int(input())
b = int(input())
c = int(input())
print(exp(a, b, c))


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	if a + b == (a + b) * c:
		print(a + b + c)
	else:
		print((a + b) * c)
elif b == 1:
	low = 0
	if a > c:
		low = c
	else:
		low = a
	if (b + low) * (a + c - low) == b + low:
		print(a + b + c)
	else:
		print((b + low) * (a + c - low))
elif c == 1:
	if c + b == (c + b) * a:
		print(a + b + c)
	else:
		print((c + b) * a)
else:
	print(a * b * c)


x = int(input())
y = int(input())
z = int(input())
max1 = x
if x + y * z > max1:
	max1 = x + y * z
if x * (y + z) > max1:
	max1 = x * (y + z)
if x * y * z > max1:
	max1 = x * y * z
if x + y + z > max1:
	max1 = x + y + z
if (x + y) * z > max1:
	max1 = (x + y) * z
print(max1)


a = int(input())
b = int(input())
c = int(input())
p = a * b * c
q = (a + b) * c
r = a + b + c
s = a * (b + c)
t = [p, q, r, s]
t.sort()
print(t[3])


a = eval(input())
b = eval(input())
c = eval(input())
if a == 1 and c == 1:
	print(b + 2)
elif a == 1:
	print((a + b) * c)
elif b == 1:
	if a >= c:
		print(a * (b + c))
	else:
		print((a + b) * c)
elif c == 1:
	print(a * (b + c))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
n1 = a + b + c
n2 = a * b * c
n3 = (a + b) * c
n4 = a * (b + c)
m = max(n1, n2, n3, n4)
print(m)


(a, b, c) = [int(input()) for i in range(3)]
funcs = lambda a, b, c: [a + b + c, a * b + c, a + b * c, (a + b) * c, a * (b + c), a * b * c]
print(max(funcs(a, b, c)))


a = int(input())
b = int(input())
c = int(input())

def op1(x, y, z):
	return x + y + z

def op2(x, y, z):
	return x + y * z

def op3(x, y, z):
	return x * y + z

def op4(x, y, z):
	return (x + y) * z

def op5(x, y, z):
	return x * (y + z)

def op6(x, y, z):
	return x * y * z
operations = [op1(a, b, c), op2(a, b, c), op3(a, b, c), op4(a, b, c), op5(a, b, c), op6(a, b, c)]
max = operations[0]
for i in range(1, len(operations)):
	if operations[i] > max:
		max = operations[i]
print(max)


a = int(input())
b = int(input())
c = int(input())
mx = -274356789
mx = max(mx, a + b + c)
mx = max(mx, a * b * c)
mx = max(mx, (a + b) * c)
mx = max(mx, a * (b + c))
mx = max(mx, a + b * c)
mx = max(mx, a * b + c)
print(mx)


from sys import stdin
z = int(stdin.readline().strip())
y = int(stdin.readline().strip())
x = int(stdin.readline().strip())
a = x + y * z
b = x * (y + z)
c = x * y * z
d = (x + y) * z
e = x + y + z
if a >= b and a >= c and (a >= d) and (a >= e):
	respuesta = a
elif b >= a and b >= c and (b >= d) and (b >= e):
	respuesta = b
elif c >= a and c >= b and (c >= d) and (c >= e):
	respuesta = c
elif d >= a and d >= b and (d >= c) and (d >= e):
	respuesta = d
elif e >= a and e >= b and (e >= c) and (e >= d):
	respuesta = e
print(respuesta)


angka = int(input())
angka2 = int(input())
angka3 = int(input())
arr = []
rumus1 = angka + angka2 * angka3
arr.append(rumus1)
rumus2 = angka * (angka2 + angka3)
arr.append(rumus2)
rumus3 = angka * angka2 * angka3
arr.append(rumus3)
rumus4 = (angka + angka2) * angka3
arr.append(rumus4)
rumus5 = angka + angka2 + angka3
arr.append(rumus5)
arr.sort()
print(arr[4])


__author__ = 'runekri3'
a = int(input())
b = int(input())
c = int(input())
vals = []
vals.append(a + b + c)
vals.append(a * b + c)
vals.append(a + b * c)
vals.append(a * b * c)
vals.append((a + b) * c)
vals.append(a * (b + c))
print(max(vals))


import math
st = ''

def func(l1):
	(a, b, c) = (l1[0], l1[1], l1[2])
	return max(a + b + c, a * b * c, (a + b) * c, a * (b + c), a + b * c, a * b + c)
for _ in range(1):
	l1 = []
	for _ in range(3):
		l1.append(int(input()))
	st += str(func(l1)) + '\n'
print(st)


d = []
for i in range(0, 3):
	s = int(input())
	d.append(s)
u = d[0] + d[1] + d[2]
w = d[0] + d[1] * d[2]
x = d[0] * (d[1] + d[2])
y = d[0] * d[1] * d[2]
z = (d[0] + d[1]) * d[2]
e = [u, w, x, y, z]
print(max(e))


a = int(input())
b = int(input())
c = int(input())
mat = []
for i in range(6):
	res = 0
	if i == 0:
		res += a + b * c
	if i == 1:
		res += a * b + c
	if i == 2:
		res += a * b * c
	if i == 3:
		res += (a + b) * c
	if i == 4:
		res += a + b + c
	if i == 5:
		res += a * (b + c)
	mat.append(res)
print(max(mat))


a = int(input())
b = int(input())
c = int(input())
l = []
a1 = a + b * c
a2 = a * (b + c)
a3 = a * b * c
a4 = (a + b) * c
a5 = a + b + c
l.append(a1)
l.append(a2)
l.append(a3)
l.append(a4)
l.append(a5)
print(max(l))


l = [int(input()), int(input()), int(input())]
if l[0] == 1 and l[1] == 1 and (l[2] == 1):
	print(3)
elif 1 in l:
	i = l.index(1)
	if i == 0 or i == 2:
		opposite = l[(0, 2)[i == 0]]
		print((1 + l[1]) * opposite + (opposite if opposite == 1 else 0))
	else:
		print(min(l[0] + 1, l[2] + 1) * max(l[0], l[2]))
else:
	print(l[0] * l[1] * l[2])


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	v = a * b * c
if a == 1 and b == 1 and (c == 1):
	v = a + b + c
if a == 1 and b != 1 and (c != 1):
	v = (a + b) * c
if b == 1 and a != 1 and (c != 1):
	if a < c:
		v = (a + b) * c
	if a > c:
		v = (b + c) * a
	if a == c:
		v = (b + a) * c
if c == 1 and b != 1 and (a != 1):
	v = (c + b) * a
if a == b == 1 and c != 1:
	v = (a + b) * c
if a != 1 and b == c == 1:
	v = (c + b) * a
if a == c == 1 and b != 1:
	v = a + b + c
print(v)


list = []
while len(list) <= 2:
	list.append(int(input()))
print(max(list[0] * list[1] * list[2], list[0] + list[1] * list[2], list[0] * list[1] + list[2], (list[0] + list[1]) * list[2], (list[1] + list[2]) * list[0], list[0] + list[1] + list[2]))


x = int(input())
y = int(input())
z = int(input())
if x == 1 and z == 1:
	res = x + y + z
elif x > 1 and y > 1 and (z > 1):
	res = x * y * z
elif x == 1 and y > 1 and (z > 1):
	res = (x + y) * z
elif x > 1 and y > 1 and (z == 1):
	res = x * (y + z)
elif x > z and y == 1:
	res = x * (y + z)
else:
	res = (x + y) * z
print(res)


x = int(input())
y = int(input())
z = int(input())
total = x * y * z
total1 = (x + y) * z
total2 = x * (y + z)
total3 = x + y + z
max = 0
if total > max:
	max = total
if total1 > max:
	max = total1
if total2 > max:
	max = total2
if total3 > max:
	max = total3
print(max)


(a, b, c) = map(lambda x: int(input()), range(3))
d = [a, b, c]
operation = [lambda x, y: x + y, lambda x, y: x * y]
max_sum = 0
for i in range(2):
	for j in range(2):
		temp_action = operation[j](operation[i](a, b), c)
		temp = operation[j](operation[i](b, c), a)
		temp_action = max(temp_action, temp)
		if temp_action > max_sum:
			max_sum = temp_action
print(max_sum)


def hamsoo(a, b, c):
	beanlist = []
	beanlist.append(a + b + c)
	beanlist.append(a * b * c)
	beanlist.append((a + b) * c)
	beanlist.append(a * (b + c))
	beanlist.sort()
	return beanlist[-1]
a = int(input())
b = int(input())
c = int(input())
print(hamsoo(a, b, c))


a = [0, 0, 0]
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
m1 = a[0] * (a[1] + a[2])
m2 = a[0] * (a[1] * a[2])
m3 = (a[0] + a[1]) * a[2]
m5 = a[0] + (a[1] + a[2])
print(max(m1, m2, m3, m5))


a = int(input())
b = int(input())
c = int(input())
a1 = a + b * c
a2 = a * (b + c)
a3 = a * b * c
a4 = (a + b) * c
a5 = a + b + c
a6 = a * b + c
s = [a1, a2, a3, a4, a5, a6]
s2 = sorted(s)
print(s2[5])


TN = 1

def solution():
	a = int(input())
	b = int(input())
	c = int(input())
	ans = [a + b + c, a * b * c, a * b + c, a + b * c, a * (b + c), (a + b) * c]
	print(max(ans))
while TN != 0:
	solution()
	TN -= 1


a = int(input())
b = int(input())
c = int(input())
w = a + b + c
x = (a + b) * c
y = a * (b + c)
z = a * b * c
if w >= x and w >= y and (w >= z):
	print(w)
elif x >= w and x >= y and (x >= z):
	print(x)
elif y >= w and y >= x and (y >= z):
	print(y)
else:
	print(z)


n1 = int(input())
n2 = int(input())
n3 = int(input())
v1 = n1 + n2 + n3
v2 = (n1 + n2) * n3
v3 = n1 * (n2 + n3)
v4 = n1 * n2 * n3
x = max(v1, v2, v3, v4)
print(x)


A = int(input())
B = int(input())
C = int(input())
v = []
v.append(A + B * C)
v.append(A * (B + C))
v.append(A * B * C)
v.append((A + B) * C)
v.append(A + B + C)
v.append(A * B + C)
print(max(v))


l = []
for __ in range(3):
	l.append(int(input()))
s = []
s.append(sum(l))
s.append(l[0] * l[1] * l[2])
s.append(l[0] + l[1] * l[2])
s.append(l[0] * l[1] + l[2])
s.append((l[0] + l[1]) * l[2])
s.append(l[0] * (l[1] + l[2]))
print(max(s))


a = int(input())
b = int(input())
c = int(input())
exp1 = a * b * c
exp2 = (a + b) * c
exp3 = a * (b + c)
exp4 = a + b + c
print(max(exp1, exp2, exp3, exp4))


a = int(input())
b = int(input())
c = int(input())
l = 0
if a * b * c > l:
	l = a * b * c
if a + b + c > l:
	l = a + b + c
if a + b * c > l:
	l = a + b * c
if a * (b + c) > l:
	l = a * (b + c)
if a * b + c > l:
	l = a * b + c
if (a + b) * c > l:
	l = (a + b) * c
print(l)


def solve(a, b, c):
	x = a + b
	y = a * b
	z = b + c
	w = b * c
	return max(x + c, a + w, a * z, a * w, x * c)

def main():
	a = int(input())
	b = int(input())
	c = int(input())
	print(solve(a, b, c))
main()


a = int(input())
b = int(input())
c = int(input())
d = list(range(6))
d[1] = (a + b) * c
d[2] = a + b * c
d[3] = a * b * c
d[4] = a * (b + c)
d[5] = a + b + c
d[0] = a * b + c
print(max(d))


l = [int(input()), int(input()), int(input())]
z = [sum(l), l[0] * l[1] * l[2], l[0] * (l[1] + l[2]), (l[0] + l[1]) * l[2]]
print(max(z))


n = []
for i in range(3):
	t = int(input().strip())
	n.append(t)
case1 = n[0] + n[1] * n[2]
case2 = n[0] * n[1] + n[2]
case4 = n[0] * n[1] * n[2]
case5 = n[0] * (n[1] + n[2])
case7 = n[2] * (n[1] + n[0])
case8 = n[1] + n[2] + n[0]
l = [case1, case2, case4, case5, case7, case8]
print(max(l))


a = int(input())
b = int(input())
c = int(input())
a1 = a * b
a2 = a + b
a3 = b * c
a4 = b + c
s1 = a1 * c
s2 = a1 + c
s3 = a2 * c
s4 = a2 + c
s5 = a + a3
s6 = a * a3
s7 = a * a4
s8 = a + a4
print(max(s1, s2, s3, s4, s5, s6, s7, s8))


def mod():
	x = int(input())
	y = int(input())
	z = int(input())
	c = []
	g = x + y * z
	c.append(g)
	t = x * y * z
	c.append(t)
	u = x * (y + z)
	c.append(u)
	k = (x + y) * z
	c.append(k)
	j = x + y + z
	c.append(j)
	print(max(c))
mod()


def seperateints(x):
	k = ''
	l = []
	for i in x:
		if i == ' ':
			l.append(int(k))
			k = ''
			continue
		k = k + i
	l.append(int(k))
	return l

def luckynum(x):
	for i in x:
		if i != '4' and i != '7':
			return False
	return True
a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a + b * c)
l.append(a * (b + c))
l.append(a * b * c)
l.append((a + b) * c)
l.append(a * b + c)
l.append(a + b + c)
print(max(l))


x = int(input())
y = int(input())
z = int(input())
s = [x, y, z]
a = x * y * z
m = sum(s[0:2]) * s[2]
k = sum(s)
z = (y + z) * x
print(max(a, m, k, z))


a = int(input())
b = int(input())
c = int(input())
l = [a + b, a * b]
m = [b + c, b * c]
n = [max(l) * c, a * max(m), max(l) + c, a + max(m)]
print(max(n))


y = []
f = []
for i in range(3):
	x = int(input())
	y.append(x)
f1 = y[0] * y[1] * y[2]
f2 = (y[0] + y[1]) * y[2]
f3 = y[0] * (y[1] + y[2])
f4 = y[0] + y[1] + y[2]
f5 = y[0] + y[1] * y[2]
f6 = y[0] * y[1] + y[2]
f.append(f1)
f.append(f2)
f.append(f3)
f.append(f4)
f.append(f5)
f.append(f6)
f.sort()
print(f[5])


a = int(input())
b = int(input())
c = int(input())
maximum = 0
maximum1 = 0
(max1, max2) = (0, 0)
if a + b > maximum:
	maximum = a + b
if a * b > maximum:
	maximum = a * b
if maximum + c > maximum1:
	maximum1 = maximum + c
if maximum * c > maximum1:
	maximum1 = maximum * c
if c + b > max1:
	max1 = c + b
if c * b > max1:
	max1 = c * b
if max1 + a > max2:
	max2 = max1 + a
if max1 * a > max2:
	max2 = max1 * a
if max2 > maximum1:
	print(max2)
else:
	print(maximum1)


def mult1(a, b, c):
	return a * (b + c)

def mult2(a, b, c):
	return (a + b) * c

def mult3(a, b, c):
	return a * b * c

def mult4(a, b, c):
	return a + b + c
a = int(input())
b = int(input())
c = int(input())
d = max(mult1(a, b, c), mult2(a, b, c), mult3(a, b, c), mult4(a, b, c))
print(d)


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
w = (a + b) * c
u = a + b + c
m = max(x, y, z, w, u)
print(m)


a = int(input())
b = int(input())
c = int(input())
max1 = a * b * c
max2 = a + b + c
max3 = a * b + c
max4 = a + b * c
max5 = (a + b) * c
max6 = a * (b + c)
print(max(max1, max2, max3, max4, max5, max6))


A = int(input())
B = int(input())
C = int(input())
Val1 = A + B * C
Val2 = A * B + C
Val3 = A * (B + C)
Val4 = A * B * C
Val5 = (A + B) * C
Val6 = A + B + C
Lst = [Val1, Val2, Val3, Val4, Val5, Val6]
print(max(Lst))


a = int(input())
b = int(input())
c = int(input())
if a != 1 and b != 1 and (c != 1):
	s = a * b * c
elif a * c != 1:
	if a >= c:
		s = a * (b + c)
	else:
		s = (a + b) * c
else:
	s = a + b + c
print(s)


def F(pos, currMax, array):
	if pos == 3:
		return currMax
	else:
		return max(F(pos + 1, currMax + array[pos], array), F(pos + 1, currMax * array[pos], array))
array = [int(input()), int(input()), int(input())]
mx = 0
mx = max(mx, F(1, array[0], array))
(array[0], array[2]) = (array[2], array[0])
mx = max(mx, F(1, array[0], array))
print(mx)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
d = a + b + c
e = a * b * c
f = (a + b) * c
g = a * (b + c)
li = [d, e, f, g]
li.sort()
print(li[-1])


a = int(input())
b = int(input())
c = int(input())
d = a + b + c
e = a + (b + c)
f = a + b + c
g = a + b * c
h = (a + b) * c
i = a + b * c
j = a * b + c
k = a * b + c
l = a * (b + c)
m = a * b * c
n = a * b * c
o = a * (b * c)
print(max(d, e, f, g, h, i, j, k, l, m, n, o))


x = int(input())
y = int(input())
z = int(input())
if x == 1 and z == 1:
	print(2 + y)
elif x == 1:
	print((x + y) * z)
elif y == 1:
	print(max((x + y) * z, x * (y + z)))
elif z == 1:
	print(x * (y + z))
else:
	print(x * y * z)


a = int(input())
b = int(input())
c = int(input())
res1 = max(a + b * c, a * (b + c))
res3 = max(a * b * c, a + b + c)
res2 = max((a + b) * c, a * b + c)
print(max(res1, res2, res3))


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def ds(d):
	for i in range(2, d + 1):
		if d % i == 0:
			return i

def main():
	d = [inp() for _ in range(3)]
	possible = [(d[0] + d[1]) * d[2], d[0] * d[1] * d[2], d[0] + d[1] + d[2], d[0] * d[1] + d[2], d[0] + d[1] * d[2], d[0] * (d[1] * d[2]), d[0] + (d[1] + d[2]), d[0] * (d[1] + d[2])]
	print(max(possible))
main()


from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def yes():
	print('YES')

def no():
	print('NO')

def countDivisibles(A, B, M):
	if A % M == 0:
		return B // M - A // M + 1
	return B // M - A // M

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count
Testcase = 1
for _ in range(Testcase):
	a = inin()
	b = inin()
	c = inin()
	print(max(a + b + c, a * b * c, a + b * c, a * b + c, (a + b) * c, a * (b + c)))


x1 = int(input())
x2 = int(input())
x3 = int(input())
a = []
a.append((x1 + x2) * x3)
a.append(x1 * (x2 + x3))
a.append(x1 + x2 * x3)
a.append(x1 * x2 + x3)
a.append(x1 * x2 * x3)
a.append(x1 + x2 + x3)
print(max(a))


a = int(input(''))
b = int(input(''))
c = int(input(''))
D = [a + b + c, a + (b + c), (a + b) * c, a + b * c, a * b + c, a * (b + c), a * b * c, a * (b * c)]
D.sort()
D.reverse()
print(D[0])


(a, b, c) = (int(input()), int(input()), int(input()))
functions = [lambda x, y, z: x + y + z, lambda x, y, z: x * y + z, lambda x, y, z: x + y * z, lambda x, y, z: x * (y + z), lambda x, y, z: (x + y) * z, lambda x, y, z: x * y * z]
m = 0
for f in functions:
	v = f(a, b, c)
	if v > m:
		m = v
print(m)


import random
a = int(input())
b = int(input())
c = int(input())
ans = a + b + c
ans = max(ans, a * b * c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
print(int(ans))


m = []
for i in range(3):
	m.append(int(input()))
if 1 not in m:
	print(m[0] * m[1] * m[2])
elif m.count(1) == 1:
	n = (m[0] + m[1]) * m[2]
	if m[0] * (m[1] + m[2]) > n:
		print(m[0] * (m[1] + m[2]))
	else:
		print(n)
elif m.count(1) == 2:
	for i in range(2):
		if m[i] == 1:
			if m[i + 1] == 1:
				try:
					print((m[i] + m[i + 1]) * m[i + 2])
					break
				except IndexError:
					print((m[i] + m[i + 1]) * m[i - 1])
					break
			else:
				print(sum(m))
else:
	print(sum(m))


a = int(input())
b = int(input())
c = int(input())
expressions = ['{}+{}+{}', '{}*{}+{}', '{}+{}*{}', '{}*{}*{}', '({}+{})*{}', '{}*({}+{})']
print(max([eval(i.format(a, b, c)) for i in expressions]))


c = []
z = int(input())
x = int(input())
v = int(input())
c.append(z + x * v)
c.append(z * (x + v))
c.append(z * x * v)
c.append((z + x) * v)
c.append(z + x + v)
c.sort()
print(c[len(c) - 1])


sum1 = 0
sum2 = 0
sum3 = 0
sum4 = 0
sum5 = 0
MAX = 0
a = int(input())
b = int(input())
c = int(input())
sum1 = a * b + c
sum2 = a * (b + c)
sum3 = a * b * c
sum4 = (a + b) * c
sum5 = a + b + c
if sum1 > MAX:
	MAX = sum1
if sum2 > MAX:
	MAX = sum2
if sum3 > MAX:
	MAX = sum3
if sum4 > MAX:
	MAX = sum4
if sum5 > MAX:
	MAX = sum5
print(MAX)


a = int(input())
b = int(input())
c = int(input())
left = max(a + b, a * b)
right = max(b * c, b + c)
print(max(a + right, a * right, left + c, left * c))


a = int(input())
b = int(input())
c = int(input())
max_count = 0
if a + b + c > max_count:
	max_count = a + b + c
if (a + b) * c > max_count:
	max_count = (a + b) * c
if a * (b + c) > max_count:
	max_count = a * (b + c)
if a * b * c > max_count:
	max_count = a * b * c
print(max_count)


a = int(input())
b = int(input())
c = int(input())
ls = []
ls.append(a + b * c)
ls.append(a * (b + c))
ls.append(a * b * c)
ls.append((a + b) * c)
ls.append(a + b + c)
print(max(ls))


a = int(input())
b = int(input())
c = int(input())
result = []
result.append(a + b + c)
result.append(a * b * c)
result.append(a * (b + c))
result.append((a + b) * c)
print(max(result))


a = input()
b = input()
c = input()
res = 0
i = 0
op = ['+', '*']
n = [a, b, c]
mayor = -1
for i in op:
	for j in op:
		exp = '(' + a + i + b + ')' + j + c
		exp1 = a + i + '(' + b + j + c + ')'
		t = (eval(exp), eval(exp1), mayor)
		mayor = max(t)
print(mayor)


def larger(x, y):
	if x > y:
		return x
	return y
A = int(input())
B = int(input())
C = int(input())
ex1 = A + B + C
ex2 = A + B * C
ex3 = (A + B) * C
ex4 = A * B + C
ex5 = A * (B + C)
ex6 = A * B * C
print(larger(ex1, larger(ex2, larger(ex3, larger(ex4, larger(ex5, ex6))))))


lst = [int(input()) for i in range(3)]
lst1 = []
lst1.append(lst[0] + lst[1] * lst[2])
lst1.append(lst[0] * (lst[1] + lst[2]))
lst1.append(lst[0] * lst[1] * lst[2])
lst1.append((lst[0] + lst[1]) * lst[2])
lst1.append(lst[0] + lst[1] + lst[2])
lst1 = sorted(lst1)
print(lst1[-1])


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	arr = []
	arr.append(a + b + c)
	arr.append(a * b * c)
	arr.append((a + b) * c)
	arr.append(a * (b + c))
	arr.append(a * b + c)
	arr.append(a + b * c)
	print(max(arr))
main()


n = int(input())
m = int(input())
k = int(input())
if n == m and m == k and (k == n) and (n == 1):
	print(3)
elif n == 1 or (n == m and n == 1):
	p = n + m
	print(max(p * k, n + m + k))
elif m == 1 or (n == k and k == 1):
	if n > k:
		print(n * (k + 1))
	else:
		print((n + 1) * k)
elif k == 1 or (m == k and k == 1):
	p = m + k
	print(max(n * p, n + m + k))
else:
	print(n * m * k)


a = int(input())
b = int(input())
c = int(input())
numbers = [a, b, c]
ans1 = a + b + c
ans2 = a * (b + c)
ans3 = (a + b) * c
ans4 = a * b * c
print(max(ans1, ans2, ans3, ans4))


a = int(input())
b = int(input())
c = int(input())
i = a + b * c
j = a * (b + c)
k = a * b * c
l = (a + b) * c
m = a + b + c
print(max(i, j, k, l, m))


a = int(input())
b = int(input())
c = int(input())
S1 = a + b + c
S2 = (a + b) * c
S3 = a * (b + c)
S4 = a * b * c
print(max(S1, S2, S3, S4))


try:
	a = int(input())
	b = int(input())
	c = int(input())
	l = [a, b, c]
	m = l.index(max(l))
	if 1 in l:
		q = l.index(1)
		if m == q:
			print(a + b + c)
		elif q == 0:
			print(max(a + b * c, a + b + c, (a + b) * c))
		elif q == 1:
			print(max(a * b * c, (a + b) * c, a * (b + c), a + b + c))
		else:
			print(max(a * b * c, a * (b + c), a + b + c))
	elif m == 0:
		print(max(a * (b + c), a * b + c, a * b * c, a * (b + c)))
	elif m == 1:
		print(max(a * b + c, a + b * c, a * b * c, a * (b + c)))
	else:
		print(max((a + b) * c, a + b * c, a * b * c, a * (b + c)))
except:
	pass


a = int(input())
b = int(input())
c = int(input())
m = a + b * c
n = a * (b + c)
l = a * b * c
k = (a + b) * c
x = a * b + c
t = a + b + c
ans = max(max(max(m, k), max(n, l)), max(x, t))
print(ans)


l = list()
for i in range(3):
	m = int(input(''))
	l.append(m)
a = l[0]
b = l[1]
c = l[2]
k = list()
x = a + b * c
k.append(x)
y = a * (b + c)
k.append(y)
z = a * b * c
k.append(z)
q = (a + b) * c
k.append(q)
w = a + b + c
k.append(w)
print(max(k))


a = int(input())
b = int(input())
c = int(input())
d1 = a * b * c
if a + b >= a * b:
	d2 = (a + b) * c
else:
	d2 = a * b + c
if b + c >= b * c:
	d3 = a * (b + c)
else:
	d3 = a + b * c
d4 = a + b + c
print(max(d1, d2, d3, d4))


l = [int(input()) for i in range(3)]
nl = []
(a, b, c) = l
d = [lambda a, b, c: a + b * c, lambda a, b, c: a * (b + c), lambda a, b, c: a * b * c, lambda a, b, c: (a + b) * c, lambda a, b, c: a * b + c, lambda a, b, c: a + b + c, lambda a, b, c: a + (b + c)]
for i in d:
	nl.append(i(a, b, c))
print(max(nl))


a = int(input())
b = int(input())
c = int(input())
r = [a + b + c, a * b + c, a + b * c, a * b * c, (a + b) * c, a * (b + c)]
r.sort()
r.reverse()
print(r[0])


a1 = int(input())
a2 = int(input())
a3 = int(input())
b1 = a1 * a2 * a3
b2 = a1 * a2 + a3
b3 = a1 * (a2 + a3)
b4 = a1 + a2 + a3
b5 = a1 + a2 * a3
b6 = (a1 + a2) * a3
print(max(b1, b2, b3, b4, b5, b6))


a = float(input())
b = float(input())
c = float(input())
answer = max(a + b + c, a * b * c, (a + b) * c, a * (b + c))
ans = str(int(answer))
print(ans)


import sys
a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
ans = a + b + c
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
ans = max(ans, a * b + c)
ans = max(ans, a + b * c)
print(ans)


a = int(input())
b = int(input())
c = int(input())

def expression(a, b, c):
	if a == 1:
		if b == 1:
			if c == 1:
				return 3
			else:
				return (a + b) * c
		elif c == 1:
			return a + b + c
		else:
			return (a + b) * c
	elif b == 1:
		if c == 1:
			return a * (b + c)
		else:
			return (min(a, c) + b) * max(a, c)
	elif c == 1:
		return a * (b + c)
	else:
		return a * b * c
print(expression(a, b, c))


a = int(input())
b = int(input())
c = int(input())
var1 = a * b + c
var2 = a + b * c
var3 = (a + b) * c
var4 = a * (b + c)
var5 = a * b * c
var6 = a + b + c
mylist = [var1, var2, var3, var4, var5, var6]
print(max(mylist))


def main():
	(a, b, c) = (int(input()), int(input()), int(input()))
	allVal = []
	allVal.append(a + b + c)
	allVal.append(a + b + c)
	allVal.append(a + (b + c))
	allVal.append(a + b * c)
	allVal.append((a + b) * c)
	allVal.append(a * b + c)
	allVal.append(a * (b + c))
	allVal.append(a * b * c)
	print(max(allVal))
main()


a = int(input())
b = int(input())
c = int(input())
results = [a + b + c, a + b * c, a * b + c, a * b * c, a * (b + c), (a + b) * c]
m = max(results)
print(m)


lst = []
maxlist = []
for i in range(0, 3):
	ele = int(input())
	lst.append(ele)
a = lst[0] + lst[1] + lst[2]
maxlist.append(a)
b = lst[0] * lst[1] * lst[2]
maxlist.append(b)
c = lst[0] + lst[1] * lst[2]
maxlist.append(c)
d = lst[0] * lst[1] + lst[2]
maxlist.append(d)
e = lst[0] * (lst[1] + lst[2])
maxlist.append(e)
f = (lst[0] + lst[1]) * lst[2]
maxlist.append(f)
print(max(maxlist))


x = int(input())
y = int(input())
z = int(input())
a = x + y * z
b = x * (y + z)
c = x * y * z
d = (x + y) * z
e = x + y + z
lst = [a, b, c, d, e]
lst.sort(reverse=True)
print(lst[0])


x = int(input())
y = int(input())
z = int(input())
m = 0
for i in range(6):
	if i == 0:
		an = x * y + z
		m = max(m, an)
	elif i == 1:
		an = x + y * z
		m = max(m, an)
	elif i == 2:
		an = (x + y) * z
		m = max(m, an)
	elif i == 3:
		an = x * (y + z)
		m = max(m, an)
	elif i == 4:
		an = x * y * z
		m = max(m, an)
	elif i == 5:
		an = x + y + z
		m = max(m, an)
print(m)


def main():
	(a, b, c) = [int(input()) for i in range(3)]
	print(max(a * b * c, (a + b) * c, a * (b + c), a + b + c))
main()


a = int(input())
b = int(input())
c = int(input())
result = 0
if a != 1:
	if b != 1:
		if c != 1:
			result = a * b * c
		else:
			result = a * (b + 1)
	elif c != 1:
		result = max([a, c]) * (min([a, c]) + 1)
	else:
		result = 2 * a
elif b == 1:
	if c != 1:
		result = 2 * c
	else:
		result = 3
elif c == 1:
	result = b + 2
else:
	result = (1 + b) * c
print(result)


a = int(input())
b = int(input())
c = int(input())
n1 = a + b * c
n2 = a * (b + c)
n3 = a * b * c
n4 = (a + b) * c
n5 = a + b + c
n6 = a * b + c
m1 = max(n1, n2)
m2 = max(n3, n4)
m3 = max(n5, n6)
o1 = max(m1, m2)
o2 = max(m2, m3)
o3 = max(o1, o2)
print(o3)


def expression(e):
	(a, b, c) = e
	g = []
	g.append(a + b + c)
	g.append(a * b * c)
	g.append(a + b * c)
	g.append(a * b + c)
	g.append((a + b) * c)
	g.append(a + b * c)
	g.append(a * b + c)
	g.append(a * (b + c))
	return max(g)
d = []
for i in range(3):
	d.append(int(input()))
print(expression(d))


from sys import stdin
x = int(stdin.readline().rstrip())
y = int(stdin.readline().rstrip())
z = int(stdin.readline().rstrip())
print(max(x + y + z, x * y + z, x * (y + z), (x + y) * z, x + y * z, x * y * z))


a = int(input())
b = int(input())
c = int(input())
x1 = []
x1.append(a + b * c)
x1.append(a * (b + c))
x1.append(a * b * c)
x1.append((a + b) * c)
x1.append(a * b + c)
x1.append(a + b + c)
x1.sort()
print(x1[-1])


def rex():
	a = int(input())
	b = int(input())
	c = int(input())
	v1 = (a + b) * c
	v2 = a * (b + c)
	v3 = a * b * c
	v4 = a + b + c
	v5 = a + b * c
	v6 = a * b + c
	return max(v1, v2, v3, v4, v5, v6)
print(rex())


a = int(input())
b = int(input())
c = int(input())
p = a + b + c
m = a * b * c
pm1 = a * b + c
pm2 = a + b * c
mb1 = a * (b * c)
mb2 = a * b * c
pb1 = (a + b) * c
pb2 = a * (b + c)
l = [p, m, pm1, pm2, mb1, mb2, pb1, pb2]
print(str(max(l)))


N1 = int(input())
N2 = int(input())
N3 = int(input())
E1 = N1 + N2 + N3
E2 = N1 * (N2 + N3)
E3 = N1 * N2 * N3
E4 = (N1 + N2) * N3
E5 = N1 + N2 * N3
A = [E1, E2, E3, E4, E5]
M = max(A)
print(M)


a = int(input())
b = int(input())
c = int(input())
m = 0
if a == c == 1:
	m = b + 2
elif b == 1 and a >= c:
	m = (b + c) * a
elif b == 1 and a < c:
	m = (b + a) * c
elif a == 1:
	m = (b + 1) * c
elif c == 1:
	m = (b + 1) * a
elif a != 1 and b != 1 and (c != 1):
	m = a * b * c
print(m)


a = int(input())
b = int(input())
c = int(input())
val = []
val.append(a + b * c)
val.append(a * (b + c))
val.append(a * b * c)
val.append((a + b) * c)
val.append(a + b + c)
print(max(val))


a = int(input())
b = int(input())
c = int(input())
x = (a + b) * c
y = a * (b + c)
z = a * b * c
w = a + b + c
mx1 = max(x, y)
mx2 = max(w, z)
print(max(mx1, mx2))


import sys
a = int(sys.stdin.readline().rstrip())
b = int(sys.stdin.readline().rstrip())
c = int(sys.stdin.readline().rstrip())
ss = []
ss.append(a)
ss.append(b)
ss.append(c)
if a == 1 and c == 1:
	tem = a + b + c
elif a == 1:
	tem = (a + b) * c
elif c == 1:
	tem = a * (b + c)
elif b == 1:
	if a < c:
		tem = (b + a) * c
	else:
		tem = (b + c) * a
else:
	tem = a * b * c
print(tem)


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
x = max(a * b, a + b)
x = max(x * c, x + c)
y = max(c * b, c + b)
y = max(y * a, y + a)
print(max(x, y))


a = int(input())
b = int(input())
c = int(input())
L = []
L.append((a + b) * c)
L.append(a + b * c)
L.append(a * b + c)
L.append(a * (b + c))
L.append(a + b + c)
L.append(a * b * c)
print(max(L))


def max_val(a, b, c):
	val = a * b * c
	temp = a * b + c
	if temp > val:
		val = temp
	temp = a * (b + c)
	if temp > val:
		val = temp
	temp = a + b * c
	if temp > val:
		val = temp
	temp = (a + b) * c
	if temp > val:
		val = temp
	temp = a + b + c
	if temp > val:
		val = temp
	return val
(a, b, c) = (int(input()), int(input()), int(input()))
print(max_val(a, b, c))


a = int(input())
b = int(input())
c = int(input())
s_1 = a + b + c
s_2 = a * b * c
s_3 = a + b * c
s_4 = a * b + c
s_5 = (a + b) * c
s_6 = a * (b + c)
print(max(s_1, s_2, s_3, s_4, s_5, s_6))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
a = int(input())
b = int(input())
c = int(input())
res = []
res.append((a + b) * c)
res.append(a * b + c)
res.append(a + b * c)
res.append(a * (b + c))
res.append(a * b * c)
res.append(a + b + c)
print(max(res))


class CodeforcesTask479ASolution:

	def __init__(self):
		self.result = ''
		self.a = 0
		self.b = 0
		self.c = 0

	def read_input(self):
		self.a = int(input())
		self.b = int(input())
		self.c = int(input())

	def process_task(self):
		self.result = str(max(self.a * self.b + self.c, self.a * (self.b + self.c), self.a + self.b * self.c, (self.a + self.b) * self.c, self.a + self.b + self.c, self.a * self.b * self.c))

	def get_result(self):
		return self.result
Solution = CodeforcesTask479ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


a = int(input())
b = int(input())
c = int(input())
t1 = a * b * c
if (a + b) * c > t1:
	t1 = (a + b) * c
if a * (b + c) > t1:
	t1 = a * (b + c)
if a + b + c > t1:
	t1 = a + b + c
if a + b * c > t1:
	t1 = a + b * c
if a * b + c > t1:
	t1 = a * b + c
print(t1)


a = int(input())
b = int(input())
c = int(input())

def funct(n):
	while n:
		if n == 1:
			return a * b * c
			break
		if n == 2:
			return a + b + c
			break
		if n == 3:
			return (a + b) * c
			break
		if n == 4:
			return a * (b + c)
			break
		if n == 5:
			return a * b + c
			break
		if n == 6:
			return a + b * c
			break
max = 0
func_num = 0
for i in range(1, 7):
	if funct(i) > max:
		max = funct(i)
		func_num = i
print(funct(func_num))


a = int(input())
b = int(input())
c = int(input())
sum = -9999
if a + b * c >= sum:
	sum = a + b * c
if a * (b + c) >= sum:
	sum = a * (b + c)
if a * (b * c) >= sum:
	sum = a * (b * c)
if (a + b) * c >= sum:
	sum = (a + b) * c
if a + b + c >= sum:
	sum = a + b + c
print(sum)


a = int(input())
b = int(input())
c = int(input())
ret = 0
ret = max(ret, a * b * c)
ret = max(ret, a + b + c)
ret = max(ret, (a + b) * c)
ret = max(ret, a * (b + c))
print(ret)


a = int(input())
b = int(input())
c = int(input())
arr = []
arr.append(a + b + c)
arr.append(a + b * c)
arr.append(a * b + c)
arr.append(a * b * c)
arr.append((a + b) * c)
arr.append(a * (b + c))
arr.sort()
print(arr[len(arr) - 1])


a = int(input())
b = int(input())
c = int(input())
first = a + b + c
second = a + b * c
third = (a + b) * c
fourth = a * b + c
fifth = a * (b + c)
sixth = a * b * c
print(max(first, second, third, fourth, fifth, sixth))


a = int(input())
b = int(input())
c = int(input())
re = []
r1 = a + b + c
re.append(r1)
r2 = a * b * c
re.append(r2)
r3 = (a + b) * c
re.append(r3)
r4 = a + b * c
re.append(r4)
r5 = a * b + c
re.append(r5)
r6 = a * (b + c)
re.append(r6)
r = max(re)
print(r)


(a, b, c) = [int(input()) for i in 'abc']
d = a * b * c
e = (a + b) * c
f = a * (b + c)
g = a + b + c
print(max(d, e, f, g))


d = []
for i in range(3):
	d.append(int(input()))
if 1 in d:
	(x, z, o) = (d[0] + d[1], d[1] + d[2], sum(d))
	print(max([x * d[2], z * d[0], o]))
else:
	print(d[0] * d[1] * d[2])


from sys import stdin, exit
import math
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
ans = max((a + b) * c, a + b * c, a + b + c, a * (b + c), a * b + c, a * b * c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
f = a * (b + c)
g = a * b * c
h = (a + b) * c
j = a + b + c
print(max(d, f, g, h, j))


import math
items = []
for _ in range(3):
	items.append(int(input()))
(a, b, c) = items
addition = lambda x, y: x + y
multiplication = lambda x, y: x * y
ops = [addition, multiplication]
solution = 0
for op in ops:
	leftmost = op(a, b)
	rightmost = op(b, c)
	for op in ops:
		left_solution = op(leftmost, c)
		right_solution = op(rightmost, a)
		solution = max(max(left_solution, right_solution), solution)
print(solution)


def isEquilibrated(n1, n2, n3):
	maxSum = 0
	sum = n1 + n2 + n3
	sum2 = (n1 + n2) * n3
	sum3 = n1 * (n2 + n3)
	sum4 = n1 * n2 * n3
	if sum2 > sum:
		maxSum = sum2
	else:
		maxSum = sum
	if maxSum < sum3:
		maxSum = sum3
	if maxSum < sum4:
		maxSum = sum4
	return maxSum
n1 = int(input())
n2 = int(input())
n3 = int(input())
arr = []
print(isEquilibrated(n1, n2, n3))


integers = [int(input()) for i in range(3)]
op1 = integers[0] + integers[1] * integers[2]
op2 = integers[0] * (integers[1] + integers[2])
op3 = (integers[0] + integers[1]) * integers[2]
op4 = integers[0] * integers[1] * integers[2]
op5 = integers[0] + integers[1] + integers[2]
print(max(op1, op2, op3, op4, op5))


a = int(input())
b = int(input())
c = int(input())
res = 0
if a == 1:
	res = a + b
	if c == 1:
		res += c
	else:
		res *= c
elif b == 1:
	if a > c:
		res = a * (b + c)
	else:
		res = (a + b) * c
elif c == 1:
	res = a * (b + c)
else:
	res = a * b * c
print(res)


ii = lambda : int(input())
(a, b, c) = (ii(), ii(), ii())
print(max(a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c)))


a = int(input())
b = int(input())
c = int(input())
m1 = (a + b) * c
m2 = a * (b + c)
m3 = a * b * c
m4 = a + b + c
print(max(m1, m2, m3, m4))


cosas1 = float(input())
cosas2 = float(input())
cosas3 = float(input())
uno = cosas1 + cosas2 * cosas3
dos = cosas1 * (cosas2 + cosas3)
tres = cosas1 * (cosas2 * cosas3)
cuatro = (cosas1 + cosas2) * cosas3
cinco = cosas1 + cosas2 + cosas3
resultados = [uno, dos, tres, cuatro, cinco]
print(int(max(resultados)))


a = int(input())
b = int(input())
c = int(input())
u = a + b + c
v = a + b * c
w = a * b + c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
r_list = [u, v, w, x, y, z]
r_list.sort()
print(r_list.pop())


a = [int(input()) for _ in range(3)]
print(max(sum(a), (a[0] + a[1]) * a[2], a[0] * (a[1] + a[2]), a[0] * a[1] * a[2]))


(x, y, z) = (int(input()), int(input()), int(input()))
a = x * y * z
b = x + y + z
c = (x + y) * z
d = x + y * z
e = x * y + z
f = x * (y + z)
l = [a, b, c, d, e, f]
l.sort()
print(l[-1])


a = int(input())
b = int(input())
c = int(input())
re1 = a + b + c
re2 = a + b * c
re3 = (a + b) * c
re4 = a * b + c
re5 = a * (b + c)
re6 = a * b * c
print(max(re1, re2, re3, re4, re5, re6))


a = int(input())
b = int(input())
c = int(input())
t_1 = (a + b) * c
t_2 = a * (b + c)
t_3 = a * b * c
t_4 = a + b + c
print(max(t_1, t_2, t_3, t_4))


a = int(input())
b = int(input())
c = int(input())
mass = []
mass.append(a + b + c)
mass.append(a * b * c)
mass.append((a + b) * c)
mass.append(a * (b + c))
mass.append(a + b * c)
mass.append(a * b + c)
print(max(mass))


a = int(input())
b = int(input())
c = int(input())
ww = a + b + c
w = (a + b) * c
x = a + b * c
y = a * (b + c)
z = a * b * c
print(max(ww, w, x, y, z))


(a, b, c) = [int(input()) for i in range(3)]

def large(a, b, c):
	m = 0
	if a + b + c > m:
		m = a + b + c
	if a * b + c > m:
		m = a * b + c
	if a + b * c > m:
		m = a + b * c
	if a * b * c > m:
		m = a * b * c
	if (a + b) * c > m:
		m = (a + b) * c
	if a * (b + c) > m:
		m = a * (b + c)
	return m
print(large(a, b, c))


from sys import stdin
a = int(stdin.readline().strip())
b = int(stdin.readline().strip())
c = int(stdin.readline().strip())
tests = []
tests.append(a + b + c)
tests.append(a * b * c)
tests.append((a + b) * c)
tests.append(a * (b + c))
tests.append(a * b + c)
tests.append(a + b * c)
print(max(tests))


def expression():
	nums = []
	for i in range(3):
		nums.append(int(input()))
	middle_num_max_with_left = max(nums[0] * nums[1], nums[0] + nums[1])
	middle_num_max_with_right = max(nums[2] * nums[1], nums[2] + nums[1])
	max_val = max(nums[0] * middle_num_max_with_right, nums[0] + middle_num_max_with_right, nums[2] + middle_num_max_with_left, nums[2] * middle_num_max_with_left)
	return max_val
print(expression())


a = int(input())
b = int(input())
c = int(input())
listnilai = []
nilai1 = (a + b) * c
nilai2 = a * (b + c)
nilai3 = a * b * c
nilai4 = a + b + c
listnilai.append(nilai1)
listnilai.append(nilai2)
listnilai.append(nilai3)
listnilai.append(nilai4)
print(max(listnilai))


def whatever(a, b, c):
	return max(a * b * c, a * (b + c), a + b + c, a + b * c, a * b + c, (a + b) * c)
a = int(input())
b = int(input())
c = int(input())
print(whatever(a, b, c))


a = int(input())
b = int(input())
c = int(input())
d = []
d.append(a + b + c)
d.append(a * b * c)
d.append(a * b + c)
d.append(a + c * b)
d.append((a + b) * c)
d.append(a * (b + c))
d.sort()
print(d[len(d) - 1])


a = int(input())
b = int(input())
c = int(input())
k = (a + b) * c
l = a + b + c
m = (b + c) * a
n = a * b * c
list = []
list.append(k)
list.append(l)
list.append(m)
list.append(n)
list.sort()
print(list[3])


a = int(input())
b = int(input())
c = int(input())
lista = [(a + b) * c, a * b * c, a * (b + c), a + b * c, a + b + c, a * b + c]
lista.sort()
print(lista[-1])


a = int(input())
b = int(input())
c = int(input())
lista = [a, b, c]
k = a * (b + c)
o = a * b + c
g = a + b + c
f = (a + b) * c
t = a * b * c
print(max(k, o, g, f, t))


f = int(input())
a = int(input())
b = int(input())
if f == 1 and a == 1 and (b == 1):
	print(f + a + b)
else:
	q = f + a * b
	w = f * (a + b)
	d = f * a * b
	s = (f + a) * b
	o = f + a + b
	print(max(q, w, d, s, o))


def operations_of_int(a, b, c):
	lis = [0] * 5
	lis[0] = a + b * c
	lis[1] = a * (b + c)
	lis[2] = a * b * c
	lis[3] = (a + b) * c
	lis[4] = a + b + c
	print(max(lis))
a = int(input())
b = int(input())
c = int(input())
operations_of_int(a, b, c)


a = int(input())
b = int(input())
c = int(input())
first = max((a + b) * c, a * b + c, a * b * c, a + b + c, a + b * c)
(a, b, c) = (b, c, a)
second = max((a + b) * c, a * b + c, a * b * c, a + b + c, a + b * c)
print(max(first, second))


a = int(input())
b = int(input())
c = int(input())
first = a + b + c
second = a + b * c
three = a * b + c
four = a * b * c
five = a * (b + c)
six = (a + b) * c
print(max(first, second, three, four, five, six))


a = int(input())
b = int(input())
c = int(input())
r1 = r2 = r3 = 0
if a == 1 or b == 1:
	r1 = (a + b) * c
if b == 1 or c == 1:
	r2 = a * (b + c)
if a == 1 and c == 1:
	r3 = a + b + c
r4 = a * b * c
print(max([r1, r2, r3, r4]))


import math
a = int(input())
b = int(input())
c = int(input())
ls = []
ls.append(a + b + c)
ls.append(a * b * c)
ls.append((a + b) * c)
ls.append(a * (b + c))
ls.append(a * b + c)
ls.append(a + b * c)
print(max(ls))


a = int(input())
b = int(input())
c = int(input())
g1 = (a + b) * c
g2 = a * (b + c)
g3 = a * b * c
g4 = a + b + c
print(max(g1, g2, g3, g4))


a = int(input())
b = int(input())
c = int(input())
ans = []
ans.append(a + b + c)
ans.append(a * b * c)
ans.append(a + b * c)
ans.append(a * b + c)
ans.append(a * (b + c))
ans.append((a + b) * c)
ans.sort()
print(ans[5])


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
l.sort()
m = [a + b + c, (a + b) * c, a * b * c, a * b + c, a + b * c, a * (b + c)]
print(max(m))


(a, b, c) = (int(input()), int(input()), int(input()))
(value_1, value_2, value_3, value_4, value_5, value_6) = (a + b + c, a * b * c, (a + b) * c, a * (b + c), a + b * c, a * b + c)
print(max(value_1, value_2, value_3, value_4, value_5, value_6))


(d, e, f, g) = (0, 0, 0, 0)
a = int(input())
b = int(input())
c = int(input())

def method(a, b, c):
	d = a + b + c
	e = a * b * c
	f = a * (b + c)
	g = (a + b) * c
	print(max(d, e, f, g))
method(a, b, c)


a = int(input())
b = int(input())
c = int(input())
s = list()
x = a * b * c
s.append(x)
x = (a + b) * c
s.append(x)
x = (c + b) * a
s.append(x)
x = a + c + b
s.append(x)
s.sort()
print(s[3])


(a, b, c) = (int(input()), int(input()), int(input()))
maxElem = 0
l = [a + b + c, a + b * c, (a + b) * c, a * b + c, a * (b + c), a * b * c]
for elem in l:
	if elem > maxElem:
		maxElem = elem
print(maxElem)


list = []
for i in range(3):
	list.append(int(input()))
a = sum(list)
b = list[0] * (list[1] + list[2])
c = list[0] * list[1] * list[2]
d = (list[0] + list[1]) * list[2]
print(max(a, b, c, d))


a = int(input())
b = int(input())
c = int(input())
l = [a * b * c, a * (b + c), a + b * c, a + b + c, a * b + c, (a + b) * c]
r = max(l)
print(r)


a = int(input())
b = int(input())
c = int(input())
A = 0
A = max(A, a + b * c)
A = max(A, a * (b + c))
A = max(A, a * b * c)
A = max(A, a + b + c)
A = max(A, (a + b) * c)
A = max(A, a * b + c)
print(A)


a = int(input())
b = int(input())
c = int(input())
max_of = 0
max_of = max(a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c)
print(max_of)


from sys import stdin
import operator
x = [int(i) for i in stdin.read().rstrip().split()]
operations = [operator.__add__, operator.__mul__]
highest = float('-inf')
for opr1 in operations:
	for opr2 in operations:
		highest = max(highest, opr2(opr1(x[0], x[1]), x[2]))
		highest = max(highest, opr2(x[0], opr1(x[1], x[2])))
print(highest)


l = []
for i in range(3):
	m = int(input())
	l.append(m)
p = []
p.append(l[0] + l[1] * l[2])
p.append(l[0] * (l[1] + l[2]))
p.append(l[0] * l[1] * l[2])
p.append((l[0] + l[1]) * l[2])
p.append(l[0] + l[1] + l[2])
print(max(p))


def max_calc(a, b, c):
	ans = a + b + c
	ans = max(ans, (a + b) * c)
	ans = max(ans, a * (b + c))
	ans = max(ans, a * b * c)
	print(ans)
max_calc(int(input()), int(input()), int(input()))


a = int(input())
b = int(input())
c = int(input())
x = a * b * c
y = (a + b) * c
z = a * (b + c)
u = a + b + c
print(max(x, y, z, u))


nrs = []
for i in range(3):
	nr = int(input(''))
	nrs.append(nr)
if nrs.count(1) == 3:
	print(3)
elif nrs[0] == nrs[2] == 1:
	print(2 + nrs[1])
else:
	if nrs[0] == 1:
		nrs[1] += 1
		nrs.pop(0)
	elif nrs[1] == 1:
		if nrs[0] > nrs[2]:
			nrs[2] += 1
		else:
			nrs[0] += 1
		nrs.pop(1)
	elif nrs[2] == 1:
		nrs[1] += 1
		nrs.pop(2)
	summa = 1
	for i in nrs:
		summa *= i
	print(summa)


s = ['(a b) c', 'a (b c)', 'a b c']
op = '+*'
l = []

def add(s):
	if ' ' in s:
		for i in op:
			add(s.replace(' ', i, 1))
	if ' ' not in s:
		l.append(s)
for eq in s:
	add(eq)
a = int(input())
b = int(input())
c = int(input())
max = 0
for eq in l:
	if eval(eq) > max:
		max = eval(eq)
print(max)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
a = int(input())
b = int(input())
c = int(input())
maxi = a * b * c
maxi = max(maxi, a * (b + c))
maxi = max(maxi, (a + b) * c)
maxi = max(maxi, a + b + c)
print(maxi)


a = int(input())
b = int(input())
c = int(input())
opt_1 = a + b + c
opt_2 = a + b * c
opt_3 = a * (b + c)
opt_4 = a * b + c
opt_5 = (a + b) * c
opt_6 = a * b * c
opt_list = [opt_1, opt_2, opt_3, opt_4, opt_5, opt_6]
opt_list.sort()
out_int = opt_list[-1]
print(out_int)


a = int(input())
b = int(input())
c = int(input())
p = max(a * b * c, a + b * c, a * b + c, a + b + c)
q = max((a + b) * c, a * b + c)
r = max(a + b * c, a * (b + c))
print(max(p, q, r))


n = int(input())
m = int(input())
a = int(input())
ls1 = []
b = n + m * a
ls1.append(b)
c = n * (m + a)
ls1.append(c)
d = n * m * a
ls1.append(d)
e = (n + m) * a
ls1.append(e)
f = n + m + a
ls1.append(f)
print(max(ls1))


aStr = input()
a = int(aStr)
bStr = input()
b = int(bStr)
cStr = input()
c = int(cStr)
result = 0
resultMax = 0
result = a + b + c
if result > resultMax:
	resultMax = result
result = a * b * c
if result > resultMax:
	resultMax = result
result = (a + b) * c
if result > resultMax:
	resultMax = result
result = a + b * c
if result > resultMax:
	resultMax = result
result = a * b + c
if result > resultMax:
	resultMax = result
result = a * (b + c)
if result > resultMax:
	resultMax = result
print(resultMax)


a = int(input())
b = int(input())
c = int(input())
count = [a, b, c].count(1)
if count == 0:
	print(a * b * c)
elif count == 2 and b != 1 or count == 3:
	print(a + b + c)
elif a == 1:
	print((1 + b) * c)
elif c == 1:
	print((1 + b) * a)
else:
	print((1 + min(a, c)) * max(a, c))


def maxval(a, b, c):
	su = a + b + c
	mu = a * b * c
	sm = a + b * c
	ms = a * b + c
	bs = (a + b) * c
	bm = a * (b + c)
	list = [su, mu, sm, ms, bs, bm]
	return max(list)
a = int(input())
b = int(input())
c = int(input())
print(maxval(a, b, c))


a = int(input())
b = int(input())
c = int(input())
x = []
x.append((a + b) * c)
x.append(a + b + c)
x.append(a * b * c)
x.append(a * b + c)
x.append(a + b * c)
x.append(a + (b + c))
x.append(a * (b * c))
x.append(a * (b + c))
x.append(a * b * c)
x.append(a + b + c)
x.sort()
print(x[::-1][0])


nums = []
for i in range(3):
	nums.append(int(input()))
values = []
values.append(nums[0] + nums[1] + nums[2])
values.append(nums[0] * nums[1] * nums[2])
values.append((nums[0] + nums[1]) * nums[2])
values.append(nums[0] + nums[1] * nums[2])
values.append(nums[0] * nums[1] + nums[2])
values.append(nums[0] * (nums[1] + nums[2]))
max = 0
for j in values:
	if j > max:
		max = j
	else:
		continue
print(max)


import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
input = lambda : sys.stdin.readline()

def solve():
	a = int(input())
	b = int(input())
	c = int(input())
	ans = a + b + c
	ans = max(ans, a * b * c)
	ans = max(ans, (a + b) * c)
	ans = max(ans, a * (b + c))
	print(ans)
solve()


a = int(input())
b = int(input())
c = int(input())
x = sorted([a, b, c])
if x[2] == 1:
	print('3')
elif x[1] == 1:
	if b == 1:
		print(2 * max(a, c))
	else:
		print(a + b + c)
elif x[0] == 1:
	if b == 1:
		print((1 + x[1]) * x[2])
	else:
		print((1 + b) * max(a, c))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
w = a + b * c
x = a * (b + c)
y = a * b * c
z = (a + b) * c
u = a + b + c
v = a * b + c
lst = [w, x, y, z, u, v]
lst.sort(reverse=True)
max = lst[0]
print(max)


a = int(input())
b = int(input())
c = int(input())
answers = []
answers.append(a + b * c)
answers.append(a * (b + c))
answers.append(a * b * c)
answers.append((a + b) * c)
answers.append(a + b + c)
answers.sort()
print(answers[-1])


mod = 1000000007
ssi = lambda : map(int, input().split())
a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a + b * c)
l.append(a + b + c)
l.append(a * b + c)
l.append((a + b) * c)
l.append(a * (b + c))
l.append(a * b * c)
print(max(l))


a = int(input())
b = int(input())
c = int(input())
l = []
s1 = a + b * c
l.append(s1)
s2 = (a + b) * c
l.append(s2)
s3 = a * (b + c)
l.append(s3)
s4 = a * b * c
l.append(s4)
s5 = a + b + c
l.append(s5)
print(max(l))


a = int(input())
b = int(input())
c = int(input())
if a + b > a * b:
	k = a + b
else:
	k = a * b
if k + c > k * c:
	ot = k + c
else:
	ot = k * c
if b + c > b * c:
	k = b + c
else:
	k = b * c
if k + a > k * a:
	ot2 = k + a
else:
	ot2 = k * a
if ot > ot2:
	print(ot)
else:
	print(ot2)


a = int(input())
b = int(input())
c = int(input())
d = a + b + c
e = a * b * c
f = a * (b + c)
g = a + b * c
h = (a + b) * c
i = a * b + c
if d > e:
	j = d
else:
	j = e
if f > g:
	k = f
else:
	k = g
if h > i:
	l = h
else:
	l = i
if j > k:
	m = j
else:
	m = k
if m > l:
	print(m)
else:
	print(l)


a = int(input())
b = int(input())
c = int(input())
res1 = a * b * c
res3 = (a + b) * c
res4 = a + b + c
res5 = a * (b + c)
print(max(res1, res3, res4, res5))


a = int(input())
b = int(input())
c = int(input())
s = [a + b + c, a + b * c, a * b + c, (a + b) * c, a * (b + c), a * b * c]
m = max(s)
print(m)


from functools import reduce
numbers = [int(input()) for _ in range(3)]
add = lambda num: sum(num)
mult = lambda num: reduce(lambda x, y: x * y, num)

def sum_mult_br(num):
	(a, b, c) = num
	return (a + b) * c

def sum_mult(num):
	(a, b, c) = num
	return a + b * c

def mult_sum(num):
	(a, b, c) = num
	return a * b + c

def mult_sum_br(num):
	(a, b, c) = num
	return a * (b + c)
operations = [add, mult, sum_mult, sum_mult_br, mult_sum, mult_sum_br]
result = 0
for op in operations:
	result = max(result, op(numbers))
print(result)


a = int(input())
b = int(input())
c = int(input())
sum = a + b + c
mul = a * b * c
p = (a + b) * c
r = a * (b + c)
s = a * b + c
u = a + b * c
print(max(sum, mul, p, r, s, u))


a = int(input())
b = int(input())
c = int(input())
F = [a + b + c, a * b + c, a * (b + c), (a + b) * c, a * (b + c), a * b * c]
m = max(F)
print(m)


a = int(input())
b = int(input())
c = int(input())
result1 = a + b + c
result2 = (a + b) * c
result3 = a * (b + c)
result4 = a * b * c
print(max(result1, result2, result3, result4))


a = int(input())
highest = a
lowest = a
b = int(input())
if b > highest:
	highest = b
if b < lowest:
	lowest = b
c = int(input())
if c > highest:
	highest = c
if c < lowest:
	lowest = c
maximum = 0
if a != 1 and b != 1 and (c != 1):
	maximum = a * b * c
elif a == 1 and b == 1 and (c == 1) or (a == 1 and c == 1 and (b != 1)):
	maximum = a + b + c
elif a == 1 or b == 1 or c == 1:
	if a == highest:
		maximum = a * (b + c)
	elif b == highest:
		if a == lowest:
			maximum = (a + b) * c
		else:
			maximum = a * (b + c)
	elif c == highest:
		maximum = (a + b) * c
print(maximum)


l = []
for i in range(3):
	l.append(int(input()))
a1 = (l[0] + l[1]) * l[2]
a2 = l[0] * (l[1] + l[2])
a3 = l[0] * l[1] * l[2]
a4 = l[0] + l[1] + l[2]
print(max(a1, a2, a3, a4))


from math import *
from collections import *
a = int(input())
b = int(input())
c = int(input())
b1 = b
if a == 1 or b == 1:
	b += a
else:
	b *= a
if c == 1:
	b += c
else:
	b *= c
if c == 1 or b1 == 1:
	b1 += c
else:
	b1 *= c
if a == 1:
	b1 += a
else:
	b1 *= a
print(max(b, b1))


a = int(input())
b = int(input())
c = int(input())
list = []
sum1 = (a + b) * c
list.append(sum1)
sum2 = a + b * c
list.append(sum2)
sum3 = a * b + c
list.append(sum3)
sum4 = a * (b + c)
list.append(sum4)
sum5 = a + b + c
list.append(sum5)
sum6 = a * b * c
list.append(sum6)
print(max(list))


a = int(input())
b = int(input())
c = int(input())
alpha = a + b + c
beta = a * b * c
gamma = a + b * c
delta = a * b + c
epsilon = (a + b) * c
zeta = a * (b + c)
solutionList = [alpha, beta, gamma, delta, epsilon, zeta]
maximum = 0
for i in range(0, 6):
	if solutionList[i] > maximum:
		maximum = solutionList[i]
print(maximum)


a = int(input())
b = int(input())
c = int(input())
l = [0, 0, 0, 0]
l[0] = a + b + c
l[1] = a * (b + c)
l[2] = (a + b) * c
l[3] = a * b * c
l.sort()
print(l[3])


a = int(input())
b = int(input())
c = int(input())
res = 0
fir = a * b * c
sec = (a + b) * c
tr = a + b + c
las = a * (b + c)
print(max(fir, sec, tr, las))


a = int(input())
b = int(input())
c = int(input())
t1 = a + b * c
t2 = a * (b + c)
t3 = a * b * c
t4 = (a + b) * c
t5 = a + b + c
t6 = (abs(a) + abs(b)) * abs(c)
t7 = abs(a) + abs(b) * abs(c)
temp = [t1, t2, t3, t4, t5, t6, t7]
print(max(temp))


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * b + c
z = (a + b) * c
v = a * (b + c)
w = a * b * c
u = a + b + c
res = max(x, y, z, v, w, u)
print(res)


a = list((int(input()) for _ in range(3)))
if a.count(1) == 3:
	res = sum(a)
elif a[0] == a[1] == 1:
	res = 2 * a[2]
elif a[1] == a[2] == 1:
	res = 2 * a[0]
elif a[0] == a[2] == 1:
	res = sum(a)
elif a[0] == 1:
	res = (a[0] + a[1]) * a[2]
elif a[2] == 1:
	res = (a[1] + a[2]) * a[0]
elif a[1] == 1 and a[0] > a[2]:
	res = (a[1] + a[2]) * a[0]
elif a[1] == 1:
	res = (a[0] + a[1]) * a[2]
else:
	res = a[0] * a[1] * a[2]
print(res)


import math
from collections import deque

def ii():
	return int(input())

def mii():
	return map(int, input().split())

def lii(n):
	return [int(input()) for _ in range(n)]

def matr(n):
	return [list(mii()) for _ in range(n)]
n = lii(3)
print(max((n[0] + n[1]) * n[2], sum(n), n[0] * (n[1] + n[2]), n[0] * n[1] * n[2]))


import sys
import math

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))
a = iinp()
b = iinp()
c = iinp()
ans = a + b + c
ans = max(ans, a * (b + c))
ans = max(ans, (a + b) * c)
ans = max(ans, a * b * c)
print(ans)


from sys import stdin, stdout

def main():
	(a, b, c) = tuple(map(int, stdin.read().split()))
	stdout.write(str(max(a + b + c, a + b * c, (a + b) * c, a * b + c, a * (b + c), a * b * c)) + '\n')
main()


(a, b, c) = (int(input()), int(input()), int(input()))
(temp1, temp2, temp3, temp4, temp5, temp6) = (a + b + c, a * b + c, a + b * c, a * b * c, (a + b) * c, a * (b + c))
print(max(temp1, temp2, temp3, temp4, temp5, temp6))


a = int(input())
b = int(input())
c = int(input())
e1 = a + b * c
e2 = a * (b + c)
e3 = a * b * c
e4 = (a + b) * c
e5 = a + b + c
print(max([e1, e2, e3, e4, e5]))


a = int(input())
b = int(input())
c = int(input())
an1 = a * (b + c)
an2 = a * b + c
an3 = (a + b) * c
an4 = a + b * c
an5 = a + b + c
an6 = a * b * c
w = [an1, an2, an3, an4, an5, an6]
print(max(w))


a = int(input())
b = int(input())
c = int(input())
t = a * b * c
r = a * (b + c)
e = a + b + c
u = (a + b) * c
print(max(t, r, e, u))


i = 0
num = list()
while i < 3:
	num.append(int(input()))
	i += 1
count = 0
if num[0] + num[1] * num[2] > count:
	count = num[0] + num[1] * num[2]
if num[0] * num[1] + num[2] > count:
	count = num[0] * num[1] + num[2]
if num[0] * (num[1] + num[2]) > count:
	count = num[0] * (num[1] + num[2])
if (num[0] + num[1]) * num[2] > count:
	count = (num[0] + num[1]) * num[2]
if num[0] * num[1] * num[2] > count:
	count = num[0] * num[1] * num[2]
if num[0] + num[1] + num[2] > count:
	count = num[0] + num[1] + num[2]
print(count)


a = int(input())
b = int(input())
c = int(input())
if a == 1 or b == 1 or c == 1:
	if a == 1 and b == 1 and (c == 1):
		z = 3
	elif a == 1 and c == 1:
		z = a + b + c
	elif a == 1 and b == 1 or (b == 1 and c == 1):
		z = 2 * max(a, b, c)
	elif b == 1:
		z = (1 + min(a, c)) * max(a, c)
	else:
		z = (1 + b) * max(a, c)
else:
	z = a * b * c
print(z)


a = []
for _ in range(3):
	a.append(int(input()))
res1 = a[0] * a[1] * a[2]
res2 = (a[0] + a[1]) * a[2]
res3 = a[0] * (a[1] + a[2])
res4 = sum(a)
print(max(res1, res2, res3, res4))


import math
num = []
res = 0
for i in range(3):
	num.append(int(input()))
if min(num) > 1:
	res = num[0] * num[1] * num[2]
elif num[1] == 1 and max(num) > 1:
	res = (1 + min([num[0], num[2]])) * max(num)
elif max(num) == 1:
	res = 3
elif num[1] != 1 and num[0] == 1 and (num[2] != 1):
	res = (1 + num[1]) * num[2]
elif num[1] != 1 and num[2] == 1 and (num[0] != 1):
	res = (1 + num[1]) * num[0]
elif num[1] != 1 and num[2] == 1 and (num[0] == 1):
	res = num[1] + 2
print(res)


num1 = int(input())
num2 = int(input())
num3 = int(input())
res = []
res.append((num1 + num2) * num3)
res.append(num1 + num2 * num3)
res.append(num1 * num2 * num3)
res.append(num1 * (num2 + num3))
res.append(num1 + num2 + num3)
print(max(res))


(a, b, c) = [int(input()) for i in range(3)]
m = s = 0
if c < a:
	(a, c) = (c, a)
m = max(a + b, a * b)
s = max(m + c, m * c)
print(s)


a = eval(input())
b = eval(input())
c = eval(input())
x = a * b * c
y = a + b + c
z = a + b * c
w = a * b + c
q = a * (b + c)
t = (a + b) * c
print(max(x, y, z, w, q, t))


a = int(input())
b = int(input())
c = int(input())
lis = list()
lis.append(a + b * c)
lis.append(a * b + c)
lis.append(a + b + c)
lis.append(a * (b + c))
lis.append(a * b * c)
lis.append((a + b) * c)
print(max(lis))


a = int(input())
b = int(input())
c = int(input())
x = []
task_1 = a + b * c
task_2 = a * (b + c)
task_3 = a * b * c
task_4 = (a + b) * c
task_5 = a + b + c
x.append(task_1)
x.append(task_2)
x.append(task_3)
x.append(task_4)
x.append(task_5)
maxim = -10000
for i in range(len(x)):
	if x[i] > maxim:
		maxim = x[i]
print(maxim)


x = int(input())
y = int(input())
z = int(input())
v1 = x + y * z
v2 = x * (y + z)
h = v2 - v1
if h > 0:
	a = v2
else:
	a = v1
v3 = x * y * z
if a < v3:
	a = v3
v4 = (x + y) * z
if a < v4:
	a = v4
v5 = x + y + z
if a < v5:
	a = v5
print(a)


l = list(map(int, [input(), input(), input()]))
ops = [lambda x, y, z: x + y + z, lambda x, y, z: x + y * z, lambda x, y, z: x * y + z, lambda x, y, z: x * y * z, lambda x, y, z: (x + y) * z, lambda x, y, z: x * (y + z)]
max_ = 0
for op in ops:
	max_ = max(op(l[0], l[1], l[2]), max_)
print(max_)


a = int(input())
b = int(input())
c = int(input())
l1 = []
l1.append(a + b * c)
l1.append(a * (b + c))
l1.append(a * b * c)
l1.append((a + b) * c)
l1.append(a + b + c)
l1.append(a * b + c)
print(max(l1))


def ck(x, y, z):
	ans = []
	ans.append(x * y * z)
	ans.append(x + y + z)
	ans.append(x * y + z)
	ans.append(x + y * z)
	ans.append((x + y) * z)
	ans.append(x * (y + z))
	return max(ans)
x = int(input())
y = int(input())
z = int(input())
print(ck(x, y, z))


li = [int(input()) for i in range(3)]
a = li[0]
b = li[1]
c = li[2]
if a == 1 and c == 1:
	tot = 2 + b
elif a == 1:
	tot = (a + b) * c
elif b == 1:
	tot = max((a + b) * c, a * (b + c))
elif c == 1:
	tot = a * (b + c)
else:
	tot = a * b * c
print(tot)


n = [int(input()), int(input()), int(input())]
if n.count(1) == 3:
	print(3)
elif n.count(1) == 2:
	if n[0] == 1 and n[1] == 1:
		print(2 * n[2])
	elif n[0] == 1 and n[2] == 1:
		print(1 + n[1] + 1)
	elif n[1] == 1 and n[2] == 1:
		print(2 * n[0])
elif n.count(1) == 1:
	if n[0] == 1:
		print((1 + n[1]) * n[2])
	elif n[1] == 1:
		print(max((1 + n[0]) * n[2], (1 + n[2]) * n[0]))
	elif n[2] == 1:
		print((1 + n[1]) * n[0])
else:
	print(n[0] * n[1] * n[2])


a = int(input())
b = int(input())
c = int(input())
string = []
string.append(a + b + c)
string.append(a * (b + c))
string.append(a + b * c)
string.append(a * b + c)
string.append((a + b) * c)
string.append(a * b * c)
print(max(string))


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	d = a + b * c
	best = d
	d = a + b + c
	if d > best:
		best = d
	d = a * (b + c)
	if d > best:
		best = d
	d = a * b * c
	if d > best:
		best = d
	d = (a + b) * c
	if d > best:
		best = d
	print(best)
main()


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
a = int(input())
b = int(input())
c = int(input())
a1 = a * b * c
a2 = a + b + c
a3 = (a + b) * c
a4 = a * (b + c)
a5 = a + b * c
a6 = a * b + c
print(max(a1, a2, a3, a4, a5, a6))


a = int(input())
b = int(input())
c = int(input())
itog1 = a + b + c
itog2 = a * b * c
itog3 = a * b + c
itog4 = a + b * c
itog5 = a * (b + c)
itog6 = (a + b) * c
print(max(itog1, itog2, itog3, itog4, itog5, itog6))


def expression(a, b, c):
	return max(a * b * c, a * (b + c), (a + b) * c, a + b + c)
a = int(input())
b = int(input())
c = int(input())
print(expression(a, b, c))


a = int(input())
b = int(input())
c = int(input())
out = []
out.append(a + b * c)
out.append(a * b + c)
out.append(a * (b + c))
out.append((a + b) * c)
out.append(a * b * c)
out.append(a + b + c)
out.sort(reverse=True)
print(out[0])


a = int(input())
b = int(input())
c = int(input())
l = [0] * 6
for i in range(6):
	if i == 0:
		l[i] += a + b * c
	elif i == 1:
		l[i] += a + b + c
	elif i == 2:
		l[i] += a * b + c
	elif i == 3:
		l[i] += (a + b) * c
	elif i == 4:
		l[i] += a * (b + c)
	else:
		l[i] += a * b * c
print(max(l))


a = int(input())
b = int(input())
c = int(input())
a_list = []
a_list.append(a + b + c)
a_list.append(a + b * c)
a_list.append(a * b + c)
a_list.append(a * b * c)
a_list.append((a + b) * c)
a_list.append(a * (b + c))
a_list.sort()
print(str(a_list[-1]))


a = int(input())
b = int(input())
c = int(input())
s = (a + b) * c
g = a * b * c
h = a * b + c
t = a + b + c
k = a * (b + c)
d = max(s, g, h, t, k)
print(d)


from itertools import product

def makes_sense(signs):
	if 'B' in signs and 'M' not in signs:
		return False
	return True

def make_ad(a, b):
	return str(a) + ' + ' + str(b)

def make_mul(a, b):
	return str(a) + ' * ' + str(b)

def make_br(a, b):
	return '(' + str(a) + ' + ' + str(b) + ')'

def make_expression(a, b, c, signs):
	if signs[1] == 'B':
		return make_mul(a, make_br(b, c))
	(first, second) = ('', '')
	if signs[0] == 'A':
		first = make_ad(a, b)
	elif signs[0] == 'M':
		first = make_mul(a, b)
	elif signs[0] == 'B':
		first = make_br(a, b)
	if signs[1] == 'A':
		return make_ad(first, c)
	if signs[1] == 'M':
		return make_mul(first, c)

def main():
	(a, b, c) = (int(input()), int(input()), int(input()))
	m = 0
	for signs in product('AMB', 'AMB'):
		if makes_sense(signs):
			expr = make_expression(a, b, c, signs)
			m = max(eval(expr), m)
	print(m)
main()


j = int(input())
k = int(input())
l = int(input())
print(max(j + k + l, (j + k) * l, j * (k + l), j * k * l))


from sys import stdin
a = int(stdin.readline())
b = int(stdin.readline())
c = int(stdin.readline())
r1 = a + b * c
r2 = a * (b + c)
r3 = a * b * c
r4 = (a + b) * c
r5 = a + b + c
r6 = a * b + c
print(max(r1, r2, r3, r4, r5, r6))


a = int(input())
b = int(input())
c = int(input())
o1 = a + b + c
o2 = a * b * c
o3 = (a + b) * c
o4 = a + b * c
o5 = a * b + c
o6 = a * (b + c)
print(max(o1, o2, o3, o4, o5, o6))


a = int(input())
b = int(input())
c = int(input())
ans = 0
(a, c) = (min(a, c), max(a, c))
if a == 1 or b == 1:
	ans = a + b
else:
	ans = a * b
if c == 1:
	ans += c
else:
	ans *= c
print(ans)


a = int(input())
b = int(input())
c = int(input())
x = [a, b, c]
if x[0] == 1:
	if x[2] == 1:
		r = x[0] + x[1] + x[2]
	else:
		r = (x[0] + x[1]) * x[2]
elif x[1] == 1:
	r = (x[1] + min(x[0], x[2])) * max(x[0], x[2])
elif x[2] == 1:
	if x[0] == 1:
		r = x[0] + x[1] + x[2]
	else:
		r = (x[2] + x[1]) * x[0]
else:
	r = x[0] * x[1] * x[2]
print(r)


a = int(input())
b = int(input())
c = int(input())
if a == 1:
	if b == 1:
		if c == 1:
			print(3)
		else:
			print((a + b) * c)
	elif c == 1:
		print(a + b + c)
	else:
		print((a + b) * c)
elif b == 1:
	if c == 1:
		print(a * 2)
	else:
		h = (a + b) * c
		h2 = a * (b + c)
		print(max(h, h2))
elif c == 1:
	print(a * (b + c))
else:
	print(a * b * c)


def expressions():
	a = int(input())
	b = int(input())
	c = int(input())
	e1 = a + b * c
	e2 = a * (b + c)
	e3 = a * b * c
	e4 = (a + b) * c
	e5 = a + b + c
	l = [e1, e2, e3, e4, e5]
	z = max(l)
	print(z)
expressions()


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	m = 0
	if a + b + c > m:
		m = a + b + c
	if a + b * c > m:
		m = a + b * c
	if a * b + c > m:
		m = a * b + c
	if (a + b) * c > m:
		m = (a + b) * c
	if a * (b + c) > m:
		m = a * (b + c)
	if a * b * c > m:
		m = a * b * c
	print(m)
main()


import sys
local_launch = False
try:
	open('LOCAL').read()
	local_launch = True
except:
	pass
input_data = open('INPUT.txt').read() if local_launch else sys.stdin.read()
done = {'i': 0}
tokens = input_data.split()

def next_token():
	result = tokens[done['i']]
	done['i'] += 1
	return result

def next_int():
	return int(next_token())

def next_str():
	return next_token()

def sum(a):
	z = 0
	for i in range(len(a)):
		z = z + a[i]
	return z

def max(a):
	maz = a[0]
	for i in range(len(a)):
		if maz < a[i]:
			maz = a[i]
	return maz

def min(a):
	mix = a[0]
	for i in range(len(a)):
		if mix > a[i]:
			mix = a[i]
	return mix

def argmax(a):
	id = 0
	maz = a[0]
	for i in range(len(a)):
		if maz < a[i]:
			maz = a[i]
			id = i
	return id

def argmin(a):
	id = 0
	mix = a[0]
	for i in range(len(a)):
		if mix > a[i]:
			mix = a[i]
			id = i
	return id

def argmax_last(a):
	id = 0
	maz = a[0]
	for i in range(len(a)):
		if maz <= a[i]:
			maz = a[i]
			id = i
	return id

def argmin_last(a):
	id = 0
	mix = a[0]
	for i in range(len(a)):
		if mix >= a[i]:
			mix = a[i]
			id = i
	return id
a = next_int()
b = next_int()
c = next_int()
x1 = a + b + c
x2 = a * b + c
x3 = a * b * c
x4 = a + b * c
x5 = (a + b) * c
x6 = a * (b + c)
z = [x1, x2, x3, x4, x5, x6]
print(max(z))


(a, b, c) = (int(input()), int(input()), int(input()))
plus = a + b + c
multiply = a * b * c
plus_m = a + b * c
mult_p = a * (b + c)
plus_m_2 = (a + b) * c
print(max(plus, multiply, plus_m, plus_m_2, mult_p))


a = int(input())
b = int(input())
c = int(input())
v = a + b + c
h = (a + b) * c
l = a * (b + c)
m = a * b * c
print(max(v, h, l, m))


j = []
for e in range(3):
	a = int(input())
	j.append(a)
if j.count(1) == 3:
	print(3)
elif j.count(1) == 2:
	if j.index(1, 1) != 1:
		print(j[0] + j[1] + j[2])
	else:
		j.sort()
		print((j[0] + j[1]) * j[2])
elif j.count(1) == 1:
	if j.index(1) == 1:
		j.sort()
		print((j[0] + j[1]) * j[2])
	elif j.index(1) == 0:
		print((j[0] + j[1]) * j[2])
	else:
		print((j[1] + j[2]) * j[0])
else:
	print(j[0] * j[1] * j[2])


a = int(input())
b = int(input())
c = int(input())
exp_val_list = []
exp_val_list.append(a + b * c)
exp_val_list.append(a * (b + c))
exp_val_list.append(a * b * c)
exp_val_list.append((a + b) * c)
exp_val_list.append(a + b + c)
exp_val_list.sort()
print(exp_val_list[len(exp_val_list) - 1])


a = int(input())
b = int(input())
c = int(input())
results = []
temp = 0
temp = a + b + c
results.append(temp)
temp = a + b * c
results.append(temp)
temp = a * (b + c)
results.append(temp)
temp = a * b * c
results.append(temp)
temp = (a + b) * c
results.append(temp)
maxResult = max(results)
print(maxResult)


a = int(input())
b = int(input())
c = int(input())
maximum = 0
ans = a * b * c
if ans > maximum:
	maximum = ans
ans = a * b + c
if ans > maximum:
	maximum = ans
ans = (a + b) * c
if ans > maximum:
	maximum = ans
ans = a + b + c
if ans > maximum:
	maximum = ans
ans = a + b * c
if ans > maximum:
	maximum = ans
ans = a * (b + c)
if ans > maximum:
	maximum = ans
print(maximum)


import sys
a = int(input())
b = int(input())
c = int(input())
answer = 0
if a <= 1 and c <= 1:
	print(a + b + c)
elif a <= 1:
	print((a + b) * c)
elif c <= 1:
	print((c + b) * a)
elif b <= 1:
	if a < c:
		print((a + b) * c)
	else:
		print((c + b) * a)
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
s = a * b * c
temp1 = (a + b) * c
temp2 = a * (b + c)
temp3 = a + b + c
if temp1 > s:
	s = temp1
if temp2 > s:
	s = temp2
if temp3 > s:
	s = temp3
print(s)


array = set()

def urmum(args):
	if len(args) == 1:
		for i in args:
			array.add(i)
		return 0
	for index in range(len(args) - 1):
		i = args[index]
		j = args[index + 1]
		urmum(args[:index] + [i + j] + args[index + 2:])
		urmum(args[:index] + [i * j] + args[index + 2:])
list_of_args = []
for _ in range(3):
	list_of_args.append(int(input()))
urmum(list_of_args)
print(max(array))


A = int(input())
B = int(input())
C = int(input())
P1 = A + B + C
P2 = A * B * C
P3 = A + B * C
P4 = A * B + C
P5 = A * (B + C)
P6 = (A + B) * C
Ar = [P1, P2, P3, P4, P5, P6]
Mayor = P1
for K in range(1, 6):
	if Ar[K] > Mayor:
		Mayor = Ar[K]
print(Mayor)


def main():
	(a, b, c) = tuple(map(int, [input().rstrip() for _ in range(3)]))
	ans = {a + b + c, (a + b) * c, a * (b + c), a * b * c}
	print(max(ans))
main()


l = [int(input()) for i in range(3)]
(a, b, c) = map(int, l)
if a != 1 and b != 1 and (c != 1):
	n = a * b * c
else:
	n = max(a + b + c, (a + b) * c, a * (b + c))
print(n)


a = int(input())
b = int(input())
c = int(input())
l = [a, b, c]
poss1 = a * (b + c)
poss2 = a + b * c
poss3 = a + b + c
poss4 = a * b * c
poss5 = (a + b) * c
poss6 = a * b + c
print(max(poss1, poss2, poss3, poss4, poss5, poss6))


x = int(input())
y = int(input())
z = int(input())
a1 = x * y * z
a2 = (x + y) * z
a3 = x * y + z
a4 = x * (y + z)
a5 = x + y * z
a6 = x + y + z
l = [a1, a2, a3, a4, a5, a6]
print(max(l))


n = []
n.append(int(input()))
n.append(int(input()))
n.append(int(input()))
sum = 1
if min(n) == 1:
	sum += min(n)
	i = n.index(min(n))
	sum -= 1
	n.pop(i)
	if i == 1:
		sum += min(n)
		n.pop(n.index(min(n)))
	elif i == 2:
		sum += n[1]
		n.pop(1)
	else:
		sum += n[0]
		n.pop(0)
if min(n) == 1:
	sum += n[0]
	print(sum)
	exit()
sum *= n[0]
n.pop(0)
if len(n) > 0:
	sum *= n[0] * n[1]
print(sum)


l = []
maxy = 0
a = int(input())
b = int(input())
c = int(input())
l.append(a + b * c)
l.append(a * (b + c))
l.append(a * b * c)
l.append((a + b) * c)
l.append(a + b + c)
for i in l:
	if i > maxy:
		maxy = i
print(maxy)


a = int(input())
b = int(input())
c = int(input())
list = []
s = a * b * c
list.append(s)
p = (a + b) * c
list.append(p)
q = a * (b + c)
list.append(q)
r = a + b * c
list.append(r)
d = a + b + c
list.append(d)
print(max(list))


a = int(input())
b = int(input())
c = int(input())
max_value = float('-inf')
value = a + b + c
if max_value < value:
	max_value = value
value = a + b * c
if max_value < value:
	max_value = value
value = a * (b + c)
if max_value < value:
	max_value = value
value = a * b * c
if max_value < value:
	max_value = value
value = (a + b) * c
if max_value < value:
	max_value = value
print(max_value)


import sys

def ii():
	return int(sys.stdin.readline().strip())

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	(a, b, c) = (ii(), ii(), ii())
	print(max(a * (b + c), a + b + c, a * b * c, (a + b) * c))
	return
for ______ in range(1):
	solve_of_problem()


a = int(input())
b = int(input())
c = int(input())
p = a + b * c
q = a * (b + c)
r = a * b * c
s = (a + b) * c
t = a + b + c
u = a * b + c
if (p >= q) & (p >= r) & (p >= s) & (p >= t) & (p >= u):
	print(p)
elif (q >= p) & (q >= r) & (q >= s) & (q >= t) & (q >= u):
	print(q)
elif (r >= p) & (r >= q) & (r >= s) & (r >= t) & (r >= u):
	print(r)
elif (s >= p) & (s >= q) & (s >= r) & (s >= t) & (s >= u):
	print(s)
elif (t >= p) & (t >= q) & (t >= r) & (t >= s) & (t >= u):
	print(t)
elif (u >= p) & (u >= q) & (u >= r) & (u >= s) & (u >= t):
	print(u)


import sys
import math
input = sys.stdin.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def lower_letters():
	lowercase = []
	for i in range(97, 97 + 26):
		lowercase.append(chr(i))
	return lowercase

def upper_letters():
	uppercase = []
	for i in range(65, 65 + 26):
		uppercase.append(chr(i))
	return uppercase
a = int(input())
b = int(input())
c = int(input())
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


(a, b, c) = (int(input()), int(input()), int(input()))
n1 = max(a + b + c, a * b * c)
n2 = max(a * b + c, a * (b + c))
n3 = max(a + b * c, (a + b) * c)
print(max(max(n1, n2), n3))


sequence = []
store = {}

def get_max(start, end):
	key = start * 10000 + end
	if key in store:
		return store[key]
	if start == end:
		result = sequence[start]
	else:
		result = -9999
		for i in range(start, end):
			left = get_max(start, i)
			right = get_max(i + 1, end)
			current = max(left + right, left * right)
			result = max(result, current)
	store[key] = result
	return result

def take_input():
	import sys
	for line in sys.stdin:
		sequence.append(int(line))
take_input()
max_value = get_max(0, len(sequence) - 1)
print(max_value)


a = eval(input())
b = eval(input())
c = eval(input())
x = a * b * c
s = (a + b) * c
h = a + b * c
z = a * (b + c)
y = a + b + c
m = a * b + c
if x > s and x > h and (x > z) and (x > y) and (x > m):
	print(x)
elif s > h and s > z and (s > y) and (s > m):
	print(s)
elif h > z and h > y and (h > m):
	print(h)
elif z > y and z > m:
	print(z)
elif y > m:
	print(y)
else:
	print(m)


try:
	k = []
	d = []
	g = 0
	for i in ' ' * 3:
		a = int(input())
		k.append(a)
	(a, b, c) = (k[0], k[1], k[2])
	res = [a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c]
	print(max(res))
except:
	pass


a = input()
a = int(a)
b = input()
b = int(b)
c = input()
c = int(c)
r = a + b + c
s = a * b * c
t = (a + b) * c
u = a * b + c
v = a + b * c
z = a * (b + c)
if r >= s and r >= t and (r >= u) and (r >= v) and (r >= z):
	print(r)
elif s >= s and s >= t and (s >= u) and (s >= v) and (s >= z):
	print(s)
elif t >= r and t >= s and (t >= u) and (t >= v) and (t >= z):
	print(t)
elif u >= s and u >= t and (u >= r) and (u >= v) and (u >= z):
	print(u)
elif v >= s and v >= t and (v >= u) and (v >= r) and (v >= z):
	print(v)
elif z >= s and z >= t and (z >= u) and (z >= v) and (z >= r):
	print(z)


a = int(input())
b = int(input())
c = int(input())
candi_max = 0
if a + b + c > candi_max:
	candi_max = a + b + c
if a * (b + c) > candi_max:
	candi_max = a * (b + c)
if (a + b) * c > candi_max:
	candi_max = (a + b) * c
if a * b * c > candi_max:
	candi_max = a * b * c
print(candi_max)


def get_max():
	a = int(input())
	b = int(input())
	c = int(input())
	expressions = [a * b * c, a + b + c, a * (b + c), (a + b) * c, a * b + c, a + b * c]
	return max(expressions)
print(get_max())


exec('x,y,z=' + 'int(input()),' * 3)
print(max(x + y + z, x * y * z, (x + y) * z, x * (y + z)))


a = int(input())
b = int(input())
c = int(input())
r = a + b * c
k = a * (b + c)
t = a * b * c
j = (a + b) * c
s = a * b + c
p = a + b + c
x = max(p, r, k, t, j, s)
print(x)


x = int(input())
y = int(input())
z = int(input())
dict = {'q': (x + y) * z, 'w': x + y + z, 'e': x * (y + z), 'r': x + y * z, 't': x * y * z, 'i': x * y + z}
lst = [i for i in dict.values()]
lst.sort()
print(lst[-1])


a = int(input())
b = int(input())
c = int(input())
l = []
f = a + b + c
z = a * b * c
e = (a + b) * c
r = a * (b + c)
l.append(z)
l.append(e)
l.append(r)
l.append(f)
mx = max(l)
print(mx)


a = int(input())
b = int(input())
c = int(input())
pp = a + b + c
pm1 = (a + b) * c
pm2 = a + b * c
mp1 = a * (b + c)
mp2 = a * b + c
mm = a * b * c
print(max(pp, pm1, pm2, mp1, mp2, mm))


_1 = '236a'
_2 = '339a'
_3 = '266a'
_4 = '96a'
_5 = '236a'
_6 = '281a'
_7 = '546a'
_8 = '116a'
_9 = '977a'
_10 = '266b'
_11 = '110a'
_12 = '41a'
_13 = '734a'
_14 = '133a'
_15 = '467a'
_16 = '158a'
_17 = '677a'
_18 = '580a'
_19 = '344a'
_20 = '1030a'
_21 = '705a'
_22 = '318a'
_23 = '479a'
n1 = int(input())
n2 = int(input())
n3 = int(input())
ans = n1 + n2 + n3
ans = max(ans, (n1 + n2) * n3)
ans = max(ans, n1 * (n2 + n3))
ans = max(ans, n1 * n2 * n3)
print(ans)


a = int(input())
b = int(input())
c = int(input())
if a + b < b + c:
	p = (a + b) * c
else:
	p = (b + c) * a
print(max(a * b * c, p, a + b + c))


x = []
for i in range(3):
	x.append(int(input()))
z = [x[0] + x[1] + x[2], x[0] * (x[1] + x[2]), (x[0] + x[1]) * x[2], x[0] * x[1] * x[2]]
max1 = max(z)
print(max1)


ans = 0
a = int(input())
b = int(input())
c = int(input())
if a == 1:
	ans = a + b
	if c == 1:
		ans += c
	else:
		ans *= c
elif b == 1:
	if a < c:
		ans = a + b
		if c == 1:
			ans += c
		else:
			ans *= c
	else:
		ans = b + c
		if a == 1:
			ans += a
		else:
			ans *= a
elif c == 1:
	ans = b + c
	if a == 1:
		ans += a
	else:
		ans *= a
else:
	ans = a * b * c
print(str(ans))


x = int(input())
y = int(input())
z = int(input())
pos1 = x * y * z
pos2 = x + y * z
pos3 = x * y + z
pos4 = x + y + z
pos5 = (x + y) * z
pos6 = x * (y + z)
print(max(pos1, pos2, pos3, pos4, pos5, pos6))


a = int(input())
b = int(input())
c = int(input())
listi = []
test1 = (a + b) * c
listi.append(test1)
test2 = a * (b + c)
listi.append(test2)
test3 = a + b + c
listi.append(test3)
test4 = a * b * c
listi.append(test4)
test5 = a * b * c
listi.append(test5)
test6 = a * (b * c)
listi.append(test6)
print(max(listi))


a = int(input())
b = int(input())
c = int(input())
if a == b and b == c and (a == 1):
	print(3)
elif a == b and b == c:
	print(a * b * c)
else:
	d = a * b * c
	e = a + b + c
	d = max(d, e)
	if a >= b and a >= c:
		r = a * (b + c)
	elif c >= a and c >= b:
		r = c * (a + b)
	elif a > c:
		r = a * (b + c)
	else:
		r = c * (a + b)
	print(max(r, d))


l = []
for i in range(3):
	l.append(int(input()))
(a, b, c) = (l[0], l[1], l[2])
x = max(a * b * c, a * b + c, (a + b) * c, a + b + c)
y = max(c * b * a, c * b + a, (c + b) * a)
print(max(x, y))


a = int(input())
b = int(input())
c = int(input())
w1 = a + b * c
w2 = a * (b + c)
w3 = a * b * c
w4 = (a + b) * c
w5 = a + b + c
w6 = a * b + c
my_list = [w1, w2, w3, w4, w5, w6]
max_way = max(my_list)
print(max_way)


l = []
for i in range(3):
	l.append(int(input()))
if l.count(1) == 3:
	print(3)
elif l.count(1) > 0:
	print(max((l[0] + l[1]) * l[2], max(l[0] * (l[1] + l[2]), l[0] + l[1] + l[2])))
else:
	print(l[0] * l[1] * l[2])


l = res = []
a = int(input())
l.append(a)
b = int(input())
l.append(b)
c = int(input())
l.append(c)
l.sort()
res.append(a * b * c)
res.append((a + b) * c)
res.append(a * b + c)
res.append(a + b + c)
res.append(a + b * c)
res.append(a * (b + c))
print(max(res))


a = int(input())
b = int(input())
c = int(input())
l = []
l.append(a + b + c)
l.append(a * b * c)
l.append(a * (b + c))
l.append((a + b) * c)
l.append(a * b + c)
l.append(a + b * c)
l.sort()
print(l[5])


import sys

def main():
	n = [int(sys.stdin.readline()) for x in range(3)]
	ans2 = n[0] + n[1] * n[2]
	ans3 = n[0] * (n[1] + n[2])
	ans4 = n[0] * n[1] * n[2]
	ans5 = (n[0] + n[1]) * n[2]
	ans6 = n[0] + n[1] + n[2]
	sys.stdout.write(f'{max(ans2, ans3, ans4, ans5, ans6)}')
main()


s = [0, 1, 2, 4]
for i in range(3):
	s[i] = input()
s = [int(s) for s in s]
m = s[0] * s[1] * s[2]
if m < s[0] + s[1] * s[2]:
	m = s[0] + s[1] * s[2]
if m < s[0] + s[1] + s[2]:
	m = s[0] + s[1] + s[2]
if m < (s[0] + s[1]) * s[2]:
	m = (s[0] + s[1]) * s[2]
if m < s[0] * (s[1] + s[2]):
	m = s[0] * (s[1] + s[2])
if m < s[0] * s[1] + s[2]:
	m = s[0] * s[1] + s[2]
print(m)


a = input()
b = input()
c = input()
a = int(a)
b = int(b)
c = int(c)
ans1 = a + b + c
ans = [ans1]
ans2 = a + b * c
ans.append(ans2)
ans3 = a * b + c
ans.append(ans3)
ans4 = a * b * c
ans.append(ans4)
ans5 = a + (b + c)
ans.append(ans5)
ans6 = a + b * c
ans.append(ans6)
ans7 = a * (b + c)
ans.append(ans7)
ans8 = a * (b * c)
ans.append(ans8)
ans9 = a + b + c
ans.append(ans9)
ans10 = (a + b) * c
ans.append(ans10)
ans11 = a * b + c
ans.append(ans11)
ans12 = a * b * c
ans.append(ans12)
ans_end = max(ans)
print(ans_end)


n = int(input())
o = int(input())
m = int(input())
l = []
a = n * o * m
b = n * (o + m)
c = (n + o) * m
d = n + o * m
e = n + o + m
l.append(a)
l.append(b)
l.append(c)
l.append(d)
l.append(e)
print(max(l))


l = []
for i in range(3):
	l.append(int(input()))
l1 = []
l1.append(l[0] + l[1] + l[2])
l1.append(l[0] * (l[1] + l[2]))
l1.append(l[0] * l[1] * l[2])
l1.append((l[0] + l[1]) * l[2])
print(max(l1))


a = int(input())
b = int(input())
c = int(input())
s = a + b + c
t = a + b * c
u = a * b + c
w = a * (b + c)
x = a * b * c
y = (a + b) * c
print(max(s, t, u, w, x, y))


a = int(input())
b = int(input())
c = int(input())
m = (a + b) * c
t = a * (b + c)
if m < t:
	m = t
t = a * b + c
if m < t:
	m = t
t = a + b * c
if m < t:
	m + t
t = a + b + c
if m < t:
	m = t
t = a * b * c
if m < t:
	m = t
print(m)


a = int(input())
b = int(input())
c = int(input())
calculo0 = a + b + c
calculo1 = a + b * c
calculo2 = a * (b + c)
calculo3 = a * b * c
calculo4 = (a + b) * c
print(max(calculo0, calculo1, calculo2, calculo3, calculo4))


a = int(input())
b = int(input())
c = int(input())
d = -10000000
if a + b + c > d:
	d = a + b + c
if (a + b) * c > d:
	d = (a + b) * c
if a + b * c > d:
	d = a + b * c
if a * b * c > d:
	d = a * b * c
if a * b + c > d:
	d = a * b + c
if a * (b + c) > d:
	d = a * (b + c)
print(d)


def x():
	return int(input())
a = x()
b = x()
c = x()
print(max([a + b + c, a * b * c, (a + b) * c, a * (b + c)]))


(a, b, c) = (input(), input(), input())
ops = ['*', '+']
max = 0
for op in ops:
	for op2 in ops:
		current = eval(a + op + b + op2 + c)
		if max < current:
			max = current
		current = eval('(' + a + op + b + ')' + op2 + c)
		if max < current:
			max = current
		current = eval(a + op + '(' + b + op2 + c + ')')
		if max < current:
			max = current
print(max)


lis = []
for i in range(3):
	lis.append(int(input()))
max_val = 0
if lis[0] + lis[1] + lis[2] > max_val:
	max_val = lis[0] + lis[1] + lis[2]
if lis[0] * lis[1] * lis[2] > max_val:
	max_val = lis[0] * lis[1] * lis[2]
if lis[0] + lis[1] * lis[2] > max_val:
	max_val = lis[0] + lis[1] * lis[2]
if lis[0] * lis[1] + lis[2] > max_val:
	max_val = lis[0] * lis[1] + lis[2]
if lis[0] * lis[2] + lis[2] > max_val:
	max_val = lis[0] * lis[2] + lis[2]
if lis[0] * (lis[1] + lis[2]) > max_val:
	max_val = lis[0] * (lis[1] + lis[2])
if (lis[0] + lis[1]) * lis[2] > max_val:
	max_val = (lis[0] + lis[1]) * lis[2]
print(max_val)


a = int(input())
b = int(input())
c = int(input())

def func(a, b, c):
	return (a + b * c, a * (b + c), a * b * c, (a + b) * c, a + b + c)
print(max(func(a, b, c)))


a = int(input())
b = int(input())
c = int(input())
u1 = a + b * c
u2 = a * (b + c)
u3 = a * b * c
u4 = (a + b) * c
u5 = a + b + c
print(max(u1, u2, u3, u4, u5))


n1 = int(input())
n2 = int(input())
n3 = int(input())
m1 = n1 * (n2 + n3)
m2 = (n1 + n2) * n3
m3 = n1 * n2 + n3
m4 = n1 + n2 * n3
m5 = n1 * n2 * n3
m6 = n1 + n2 + n3
print(max(m1, m2, m3, m4, m5, m6))


def main():
	l = []
	a = int(input())
	b = int(input())
	c = int(input())
	l.append(a + b + c)
	l.append((a + b) * c)
	l.append(a * (b + c))
	l.append(a * b * c)
	print(max(l))
main()


def maximo(a, b, c):
	r1 = eval(a + '+' + b + '+' + c)
	r2 = eval(a + '*' + b + '*' + c)
	r3 = eval(a + '*' + b + '+' + c)
	r4 = eval(a + '+' + b + '*' + c)
	r5 = eval('(' + a + '+' + b + ')' + '*' + c)
	r6 = eval(a + '*' + '(' + b + '+' + c + ')')
	return max([r1, r2, r3, r4, r5, r6])
(a, b, c) = (input(), input(), input())
print(maximo(a, b, c))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
import threading
import bisect
import operator
import heapq

def getLucky(limit):
	ar = [0] * 5000
	(ar[0], ar[1]) = (4, 7)
	p2 = 1
	idx = 0
	while idx <= limit:
		if 4 * 10 ** p2 > limit:
			break
		for idx in range(idx, idx + 2 ** p2):
			ar[idx + 2 ** p2] = 4 * 10 ** p2 + ar[idx]
			ar[idx + 2 ** p2 * 2] = 7 * 10 ** p2 + ar[idx]
		idx += 1
		p2 += 1
	return ar
a = int(input())
b = int(input())
c = int(input())
if a == 1:
	b += 1
if c == 1:
	b += 1
if b == 1:
	if a < c:
		a += 1
	else:
		c += 1
print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * b * c
z = (a + b) * c
m = a * (b + c)
w = a + b + c
li = []
li.append(x)
li.append(y)
li.append(z)
li.append(m)
li.append(w)
print(max(li))


g = []
while True:
	try:
		g.append(input())
	except:
		break
a = int(g[0])
b = int(g[1])
c = int(g[2])
d = a + b * c
e = a * (b + c)
f = a * b * c
k = (a + b) * c
l = a + b + c
m = a * b + c
o = [d, e, f, k, l, m]
max = 0
for i in range(len(o)):
	if o[i] > max:
		max = o[i]
print(max)


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
a = int(data())
b = int(data())
c = int(data())
ans = a + b + c
ans = max(ans, a + b * c)
ans = max(ans, (a + b) * c)
ans = max(ans, a * (b + c))
ans = max(ans, a * b * c)
print(ans)


a = int(input())
b = int(input())
c = int(input())
result = a + b + c
if result < a * b * c:
	result = a * b * c
if result < a * (b + c):
	result = a * (b + c)
if result < (a + b) * c:
	result = (a + b) * c
if result < a + b * c:
	result = a + b * c
if result < a * b + c:
	result = a * b + c
print(result)


a = int(input())
b = int(input())
c = int(input())
x = a * b * c
y = a * (b + c)
yy = a * b + c
z = (a + b) * c
zz = a + b * c
s = a + b + c
print(max(x, y, yy, z, zz, s))


def get_input():
	return (int(input()), int(input()), int(input()))
(a, b, c) = get_input()

def get_best(a, b, c):
	temp = a * b * c
	if (a + b) * c > temp:
		temp = (a + b) * c
	if a * (b + c) > temp:
		temp = a * (b + c)
	if a + b + c > temp:
		temp = a + b + c
	return temp
print(get_best(a, b, c))


lis = []
ref = ['+', '*']
refi = ['(', ')', '', '', '', '', '(', ')']
for i in range(3):
	lis.append(input())
a = 0
for i in range(2):
	for j in range(2):
		for k in range(2):
			a = max(a, eval(refi[4 * k] + lis[0] + ref[i] + refi[4 * k + 2] + lis[1] + refi[4 * k + 1] + ref[j] + lis[2] + refi[4 * k + 3]))
print(a)


a = int(input())
b = int(input())
c = int(input())
d = a + b * c
e = a * (b + c)
f = a * b * c
g = (a + b) * c
h = a + b + c
l = list((d, e, f, g, h))
maxx = max(l)
print(maxx)


a = int(input())
b = int(input())
c = int(input())
if a > 1 and b > 1 and (c > 1):
	print(a * b * c)
elif a == 1 and b == 1 and (c == 1):
	print(3)
elif a == 1 and b > 1 and (c == 1):
	print(a + b + c)
else:
	x = max(a, b, c)
	if a == x:
		print(a * (b + c))
	elif b == x:
		v = max(a, c)
		if a == v:
			print(a * (b + c))
		elif c == v:
			print((a + b) * c)
	elif c == x:
		print((a + b) * c)


arr = [int(input()) for i in range(3)]
print(max(sum(arr), (arr[0] + arr[1]) * arr[2], arr[0] + arr[1] * arr[2], arr[0] * (arr[1] + arr[2]), arr[0] * arr[1] + arr[2], arr[0] * arr[1] * arr[2]))


a = int(input())
b = int(input())
c = int(input())
aa = a + b + c
bb = a * b + c
d = a + b * c
f = a * (b + c)
g = a * b * c
h = (a + b) * c
max1 = max(f, d, g, h, aa, bb)
print(max1)


import math as mt
import sys as sy

class abc:

	def mkl(self):
		li = []
		a = int(input())
		b = int(input())
		c = int(input())
		li.append(a + b * c)
		li.append(a * (b + c))
		li.append(a * b * c)
		li.append((a + b) * c)
		li.append(a + b + c)
		print(max(li))
b = abc()
b.mkl()


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
eq_1 = lambda a, b, c: a * b * c
eq_2 = lambda a, b, c: (a + b) * c
eq_3 = lambda a, b, c: a * (b + c)
eq_4 = lambda a, b, c: a + b + c
eq_5 = lambda a, b, c: a + b * c
eq_6 = lambda a, b, c: a * b + c
print(max([eq_1(a, b, c), eq_2(a, b, c), eq_3(a, b, c), eq_4(a, b, c), eq_5(a, b, c), eq_6(a, b, c)]))


a = int(input())
b = int(input())
c = int(input())
max = -1000
if a + b + c >= max:
	max = a + b + c
if (a + b) * c >= max:
	max = (a + b) * c
if a * b * c >= max:
	max = a * b * c
if a * (b + c) >= max:
	max = a * (b + c)
print(max)


a = int(input())
b = int(input())
c = int(input())
m = a * (b + c)
n = (a + b) * c
s = a * b * c
t = a + b + c
p = a + b * c
q = a * b + c
print(max(m, n, s, t, p, q))


a = int(input())
b = int(input())
c = int(input())
s = a + b * c
g = a * (b + c)
f = a * b * c
k = (a + b) * c
j = a + b + c
print(max(s, g, f, k, j))


a = [int(input())]
b = [int(input())]
c = [int(input())]
ans = []

def cases(xlist, ylist):
	ret = []
	for x in xlist:
		for y in ylist:
			ret.append(x + y)
			ret.append(x * y)
	return ret
ab = cases(a, b)
bc = cases(b, c)
abc1 = cases(a, bc)
abc2 = cases(ab, c)
abc1.extend(abc2)
print(max(abc1))


a = int(input())
b = int(input())
c = int(input())
B = []
B.append(a + b + c)
B.append((a + b) * c)
B.append((b + c) * a)
B.append(b * c + a)
B.append(a * b + c)
B.append(a * b * c)
print(max(B))


a = int(input(''))
b = int(input(''))
c = int(input(''))
ans = a + b + c
ans1 = a * b * c
ans2 = (a + b) * c
ans3 = a * (c + b)
d = max(ans, ans1, ans2, ans3)
print(d)


a = int(input())
b = int(input())
c = int(input())
answer1 = a * b * c
answer2 = a + b * c
answer3 = a * (b + c)
answer4 = a + b * c
answer5 = (a + b) * c
answer6 = a + b + c
l = [answer1, answer2, answer3, answer4, answer5, answer6]
t = sorted(l, key=int)
print(t[-1])


def fd70000000():
	a = int(input())
	b = int(input())
	c = int(input())
	fn = lambda a, b, c: max(a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c))
	return print(fn(a, b, c))
fd70000000()


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * b + c
x3 = a * (b + c)
z = (a + b) * c
x1 = a + b + c
x2 = a * b * c
print(max([x3, x, y, z, x, x1, x2]))


a = int(input())
b = int(input())
c = int(input())
max1 = a + b + c
if a + b * c > max1:
	max1 = a + b * c
if a * b + c > max1:
	max1 = a + b * c
if (a + b) * c > max1:
	max1 = (a + b) * c
if a * (b + c) > max1:
	max1 = a * (b + c)
if a * b * c > max1:
	max1 = a * b * c
print(max1)


a = int(input(''))
b = int(input(''))
c = int(input(''))
if a > 1 and b > 1:
	if c > 1:
		ans = a * b * c
	else:
		ans = a * (b + c)
elif a == 1 and b > 1:
	if c > 1:
		ans = (a + b) * c
	else:
		ans = a + b + c
elif a == 1 and b == 1:
	if c > 1:
		ans = (a + b) * c
	else:
		ans = a + b + c
elif a < c and c > 1:
	ans = (a + b) * c
elif a > c and c > 1:
	ans = a * (b + c)
else:
	ans = a * (b + c)
print(ans)


n = 3
ans = 0
a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	ans = a + b + c
elif a == 1 and c == 1:
	ans = a + b + c
elif a == 1:
	ans = (a + b) * c
elif b == 1:
	if a < c:
		ans = (a + b) * c
	else:
		ans = a * (b + c)
elif c == 1:
	ans = a * (b + c)
else:
	ans = a * b * c
print(ans)


x = int(input())
y = int(input())
z = int(input())
s1 = x * y * z
s2 = x + y + z
s3 = (x + y) * z
s4 = x * (y + z)
print(max(s1, s2, s3, s4))


i = input
a = int(i())
b = int(i())
c = int(i())
if a == 1 and b == 1 and (c == 1):
	print(3)
	exit()
if a == 1 and c == 1:
	print(a + b + c)
	exit()
if a == 1:
	print((b + 1) * c)
elif b == 1:
	print((min(a, c) + 1) * max(a, c))
elif c == 1:
	print((b + 1) * a)
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
mas = []
mas.append(a * (b + c))
mas.append(a + b * c)
mas.append(a + b + c)
mas.append(a * b * c)
mas.append((a + b) * c)
print(max(mas))


l = []
for _ in range(3):
	l.append(int(input()))
print(max(l[0] + l[1] + l[2], (l[0] + l[1]) * l[2], l[0] * (l[1] + l[2]), l[0] * l[1] * l[2]))


import sys
import math
Input = sys.stdin.readline
tmp = 1
(a, b, c) = (int(input()), int(input()), int(input()))
print(max(a + b + c, a * b * c, (a + b) * c, a * (b + c)))


a = int(input(''))
b = int(input(''))
c = int(input(''))
l = []
one = a + b * c
two = a * (b + c)
three = a * b * c
four = (a + b) * c
five = a + b + c
l.append(one)
l.append(two)
l.append(three)
l.append(four)
l.append(five)
print(max(l))


p = int(input())
q = int(input())
r = int(input())
print(max(p * q * r, p + q + r, p * q + r, p + q * r, p * (q + r), (p + q) * r))


(a, b, c) = [int(input()) for i in '___']
print(max(a * b * c, a * (b + c), (a + b) * c, a + b + c))


import sys
a = int(input())
b = int(input())
c = int(input())
e = a + b * c
f = a * (b + c)
g = c * (a * b)
h = (a + b) * c
i = a + b + c
j = a * b + c
print(max(e, f, g, h, i, j))


a = int(input())
b = int(input())
c = int(input())
add = a + b + c
mul = a * b * c
addmul = a + b * c
muladd = a * (b + c)
z = (a + b) * c
print(max(add, mul, addmul, muladd, z))


a = int(input())
b = int(input())
c = int(input())
z = a * b * c
x = (a + b) * c
v = a * (b + c)
d = a + b + c
n = max(z, x, v, d)
print(n)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	ans = [a + b + c, a + b * c, a * b + c, a * b * c, (a + b) * c, a * (b + c)]
	ans.sort()
	print(ans[-1])
main()


a = int(input())
b = int(input())
c = int(input())
m = a * b * c
n = a * (b + c)
s = a + b + c
t = (a + b) * c
print(max(m, n, s, t))


x = int(input())
y = int(input())
z = int(input())
if x != 1 and y != 1 and (z != 1):
	print(x * y * z)
elif x == 1 and y == 1 and (z == 1):
	print(3)
elif x == 1 and y == 1:
	print((x + y) * z)
elif x == 1 and z == 1:
	print(x + y + z)
elif y == 1 and z == 1:
	print(x * (y + z))
elif x == 1:
	print((x + y) * z)
elif z == 1:
	print(x * (y + z))
elif y == 1 and x > z:
	print((y + z) * x)
elif y == 1 and x < z:
	print((y + x) * z)
elif y == 1 and x == z:
	print((y + x) * z)


a = int(input())
b = int(input())
c = int(input())
hoogste = 0
if a + b + c > hoogste:
	hoogste = a + b + c
if a * b * c > hoogste:
	hoogste = a * b * c
if a * (b + c) > hoogste:
	hoogste = a * (b + c)
if (a + b) * c > hoogste:
	hoogste = (a + b) * c
if a * b + c > hoogste:
	hoogste = a * b + c
if a + b * c > hoogste:
	hoogste = a + b * c
print(hoogste)


a = int(input())
b = int(input())
c = int(input())
aa = a * b * c
bb = a + b + c
cc = a * (b + c)
ee = c * (a + b)
z = max(aa, bb, cc, ee)
print(z)


a = int(input())
b = int(input())
c = int(input())
list = []
list.append(a + b + c)
list.append(a * b * c)
list.append(a * b + c)
list.append(a + b * c)
list.append(a * (b + c))
list.append((a + b) * c)
list.sort(reverse=True)
print(list[0])


def main():
	(a, b, c) = (int(input()), int(input()), int(input()))
	values = []
	values.append(a + b + c)
	values.append(a * b + c)
	values.append(a + b * c)
	values.append(a * b * c)
	values.append(a * (b + c))
	values.append((a + b) * c)
	print(sorted(values, reverse=True)[0])
main()


data = []
for i in range(3):
	data.append(int(input()))
if data[1] == 1:
	del data[1]
	data[data.index(min(data))] += 1
if data[0] == 1:
	del data[0]
	data[0] += 1
if data[-1] == 1:
	del data[-1]
	data[-1] += 1
prod = 1
for i in data:
	prod *= i
print(prod)


def maxExpression(a, b, c):
	res = 0
	if a == 1 or b == 1 or c == 1:
		if a + b < b + c:
			res = a + b
			if c == 1:
				res += c
			else:
				res *= c
		else:
			res = b + c
			if a == 1:
				res += a
			else:
				res *= a
	else:
		res = a * b * c
	return res
a = int(input())
b = int(input())
c = int(input())
print(maxExpression(a, b, c))


a = int(input())
b = int(input())
c = int(input())
sums = []
sums.append(a + b * c)
sums.append(a * (b + c))
sums.append(a * b * c)
sums.append((a + b) * c)
sums.append(a + b + c)
print(max(sums))


a = int(input())
b = int(input())
c = int(input())
temp = []
res1 = a + b + c
temp.append(res1)
res2 = a + b * c
temp.append(res2)
res3 = a * (b * c)
temp.append(res3)
res4 = a * (b + c)
temp.append(res4)
res5 = a * b * c
temp.append(res5)
res6 = (a + b) * c
temp.append(res6)
res7 = a * b + c
temp.append(res7)
temp.sort()
res = temp[-1]
print(res)


def main():
	a = int(input())
	b = int(input())
	c = int(input())
	p = a + b + c
	q = (a + b) * c
	r = a * b * c
	s = a * (b + c)
	print(max(p, q, r, s))
main()


from sys import stdin
arr = [int(x) for x in stdin.readline().rstrip().split()]
a = arr[0]
arr = [int(x) for x in stdin.readline().rstrip().split()]
b = arr[0]
arr = [int(x) for x in stdin.readline().rstrip().split()]
c = arr[0]
print(max([a + b + c, a * b + c, a + b * c, a * b * c, (a + b) * c, a * (b + c)]))


a = int(input())
b = int(input())
c = int(input())
answers = []
answers.append((a + b) * c)
answers.append(a * (b + c))
answers.append(a * b * c)
answers.append(a + b + c)
big = max(answers)
print(big)


a = int(input())
b = int(input())
c = int(input())
_ = 0
if _ < a * b * c:
	_ = a * b * c
if _ < a + b + c:
	_ = a + b + c
if _ < (a + b) * c:
	_ = (a + b) * c
if _ < a * (b + c):
	_ = a * (b + c)
if _ < a * b + c:
	_ = a * b + c
if _ < a + b * c:
	_ = a + b * c
print(_)


a = int(input())
b = int(input())
c = int(input())
w = (a + b) * c
if a * (b + c) > w:
	w = a * (b + c)
if a + b * c > w:
	w = a + b * c
if a * b * c > w:
	w = a * b * c
if a + b + c > w:
	w = a + b + c
print(w)


n1 = int(input())
n2 = int(input())
n3 = int(input())
result = 0
nu1 = [(n1 + n2) * n3, n1 * (n2 + n3), n1 + n2 * n3, n1 * n2 * n3, n1 + n2 + n3]
for f in nu1:
	if result < f:
		result = f
print(result)


def max(x, y):
	if x > y:
		return x
	else:
		return y
a = int(input())
b = int(input())
c = int(input())
if a == 1:
	print(max(b + 2, c * (b + 1)))
elif b > 1:
	print(max(a * b * c, a * (b + c)))
else:
	print(max(a * (c + 1), c * (a + 1)))


a = int(input())
b = int(input())
c = int(input())
s = set()
s.add(a + b * c)
s.add(a * (b + c))
s.add(a * b * c)
s.add((a + b) * c)
s.add(a + b + c)
print(max(s))


p = int(input())
q = int(input())
r = int(input())
a = int(p * (q + r))
b = int((p + q) * r)
c = int(p * q + r)
d = int(p * q * r)
e = int(p + q * r)
f = int(p + q + r)
y = max(a, b, c, d, e, f)
print(y)


a = int(input())
b = int(input())
c = int(input())
nums = [a, b, c]
if a == c == 1:
	print(a + b + c)
elif a == 1:
	print((a + b) * c)
elif c == 1:
	print(a * (b + c))
elif b == 1:
	print((b + min(a, c)) * max(a, c))
else:
	print(a * b * c)


a = int(input())
b = int(input())
c = int(input())
k = []
k.append(a + b * c)
k.append(a * (b + c))
k.append(a * b * c)
k.append((a + b) * c)
k.append(a + b + c)
k.sort()
print(k[4])


mx = lambda a, b, c: max(a * b * c, a * (b + c), (a + b) * c, a + b + c)
print(mx(int(input()), int(input()), int(input())))


x = list()
for i in range(3):
	x.append(input())
for i in range(3):
	x[i] = int(x[i])
r = x[0]
g = x[1]
b = x[2]
res1 = r + g * b
res2 = r * (g + b)
res3 = r * g * b
res4 = (r + g) * b
res5 = r + g + b
print(max(res1, res2, res3, res4, res5))


a = int(input()) - 1
b = int(input()) - 1
c = int(input()) - 1
A = [a, b, c]
A.sort()
if A[1] == 0:
	if a + c == 0:
		print(a + b + c + 3)
	elif a == 0:
		print(2 * (c + 1))
	else:
		print(2 * (a + 1))
elif b == 0:
	if a == A[1]:
		print((a + 2) * (c + 1))
	else:
		print((c + 2) * (a + 1))
elif a == 0:
	print((b + 2) * (c + 1))
elif c == 0:
	print((b + 2) * (a + 1))
else:
	print((a + 1) * (b + 1) * (c + 1))


a = int(input())
b = int(input())
c = int(input())
s = 0
s = a + b + c
s = max(s, a * b * c)
s = max(s, (a + b) * c)
s = max(s, a * (b + c))
s = max(s, a + b * c)
s = max(s, a * b + c)
print(s)


a = int(input())
b = int(input())
c = int(input())
d = lambda x, y, z: x * y * z
e = lambda x, y, z: (x + y) * z
f = lambda x, y, z: x * (y + z)
g = lambda x, y, z: x + y + z
mx = max(d(a, b, c), e(a, b, c), f(a, b, c), g(a, b, c))
print(mx)


a = int(input().strip())
b = int(input().strip())
c = int(input().strip())
import operator
ops = {'+': operator.add, '*': operator.mul}

def maxWithBrackets(operator_1, operator_2):
	brackets_1 = ops[operator_2](ops[operator_1](a, b), c)
	brackets_2 = ops[operator_1](ops[operator_2](b, c), a)
	return max([brackets_1, brackets_2])
plus_plus = maxWithBrackets('+', '+')
plus_times = maxWithBrackets('+', '*')
times_plus = maxWithBrackets('*', '+')
times_times = maxWithBrackets('*', '*')
print(max([plus_plus, plus_times, times_plus, times_times]))


u = int(input())
i = int(input())
y = int(input())
v = u + i * y
c = u * (i + y)
x = u * y * i
z = (u + i) * y
v = u + i + y
print(max([v, c, x, z]))


num = []
for i in range(3):
	num.append(int(input()))
a = num[0] + num[1] + num[2]
b = num[0] + num[1] * num[2]
c = num[0] * num[1] + num[2]
d = num[0] * num[1] * num[2]
e = (num[0] + num[1]) * num[2]
f = num[0] * (num[1] + num[2])
print(max([a, b, c, d, e, f]))


a = int(input())
b = int(input())
c = int(input())
m = a * (b + c)
m2 = (a + b) * c
m3 = a * b * c
m4 = a + b + c
print(max(m, m2, m3, m4))


a = int(input())
b = int(input())
c = int(input())
val = a + b + c
if (a + b) * c > val:
	val = (a + b) * c
if a + b * c > val:
	val = a + b * c
if a * (b + c) > val:
	val = a * (b + c)
if a * b + c > val:
	val = a * b + c
if a * b * c > val:
	val = a * b * c
print(val)


a = []
b = 0
for _ in range(3):
	a.append(int(input()))
if a[0] == 1:
	if a[1] != 1 and a[2] != 1:
		print((1 + a[1]) * a[2])
	elif a[1] == 1 and a[2] == 1:
		print(3)
	elif a[1] == 1 and a[2] != 1:
		print(2 * a[2])
	elif a[1] != 1 and a[2] == 1:
		print(sum(a))
elif a[1] == 1:
	mx = max(a[0], a[2])
	mn = min(a[0], a[2])
	if a[2] != 1:
		print((mn + 1) * mx)
	elif a[2] == 1:
		print(a[0] * 2)
elif a[2] == 1:
	print(a[0] * (a[1] + 1))
else:
	print(a[1] * a[0] * a[2])


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
x1 = a * b * c
x2 = a + b * c
x3 = a * b + c
x4 = a * (b + c)
x5 = (a + b) * c
mas = [x, x1, x2, x3, x4, x5]
print(max(mas))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
a = iinput()
b = iinput()
c = iinput()
s = a + b * c
s1 = a * (b + c)
s2 = a * b * c
s3 = (a + b) * c
s4 = a + b + c
print(max(s, s1, s2, s3, s4))


a = int(input())
b = int(input())
c = int(input())
maior = a * b * c
if a + b * c > maior:
	maior = a + b * c
if a * b + c > maior:
	maior = a * b + c
if a * (b + c) > maior:
	maior = a * (b + c)
if (a + b) * c > maior:
	maior = (a + b) * c
if a + b + c > maior:
	maior = a + b + c
print(maior)


a = int(input())
b = int(input())
c = int(input())
n = []
n.append(a + b + c)
n.append(a * b * c)
n.append(a * b + c)
n.append(a + b * c)
n.append(a * (b + c))
n.append((a + b) * c)
print(max(n))


import sys

class Scanner:

	def __init__(self):
		self.current_tokens = []

	def remaining_tokens(self):
		return len(self.current_tokens)

	def nextline(self):
		assert self.remaining_tokens() == 0, 'Reading next line with remaining tokens'
		return input()

	def nexttokens(self):
		return self.nextline().split()

	def nexttoken(self):
		if len(self.current_tokens) == 0:
			self.current_tokens = self.nexttokens()
		assert self.remaining_tokens() > 0, 'Not enough tokens to parse.'
		return self.current_tokens.pop(0)

	def nextints(self, n=-1):
		if n == -1:
			return list(map(int, self.nexttokens()))
		else:
			return (self.nextint() for i in range(n))

	def nextint(self):
		return int(self.nexttoken())

def quit():
	sys.exit(0)
stdin = Scanner()
nextint = stdin.nextint
nextints = stdin.nextints
nextline = stdin.nextline
(a, b, c) = nextints(3)
s0 = a + b + c
s1 = (a + b) * c
s2 = a + b * c
s3 = a * b * c
s4 = a * (b + c)
print(max(s0, s1, s2, s3, s4))


n = int(input(''))
n1 = int(input(''))
n2 = int(input(''))

def mayor(a, b):
	return a if a > b else b
A = n + n1 * n2
B = n * (n1 + n2)
C = n * n1 * n2
D = (n + n1) * n2
E = n1 + n2 + n
print(mayor(mayor(mayor(A, B), mayor(C, D)), E))


a = int(input())
b = int(input())
c = int(input())
if 1 not in (a, b, c):
	print(a * b * c)
elif a == 1 and b == 1 and (c == 1):
	print(3)
elif a == 1 and b == 1:
	print((a + b) * c)
elif a == 1 and c == 1:
	print(a + b + c)
elif b == 1 and c == 1:
	print(a * (b + c))
elif a == 1:
	print((a + b) * c)
elif c == 1:
	print(a * (b + c))
else:
	print(max((a + b) * c, a * (b + c)))


R = lambda : int(input())
a = R()
b = R()
c = R()
x = (a + b) * c
y = a * b * c
z = a * (b + c)
s = a + b + c
print(max(s, x, y, z))


sp = []
a = int(input())
b = int(input())
c = int(input())
sp.append(a + b + c)
sp.append(a + b * c)
sp.append((a + b) * c)
sp.append(a * b + c)
sp.append(a * (b + c))
sp.append(a * b * c)
print(max(sp))


i = input
(a, b, c) = map(int, [i(), i(), i()])
print(max(a + b + c, a * (b + c), (a + b) * c, a * b * c))


(a, b, c) = (int(input()), int(input()), int(input()))
res = lambda x, y, z: max(x + y + z, x + y * z, (x + y) * z, x * y + z, x * (y + z), x * y * z)
print(res(a, b, c))


__author__ = 'Utena'
a = int(input())
b = int(input())
c = int(input())
print(max(a + b + c, a + b * c, a * b + c, (a + b) * c, a * (b + c), a * b * c))


arr = []
arr.append(int(input()))
arr.append(int(input()))
arr.append(int(input()))
ans = []
ans.append(arr[0] + arr[1] + arr[2])
ans.append((arr[0] + arr[1]) * arr[2])
ans.append(arr[0] + arr[1] * arr[2])
ans.append(arr[0] * (arr[1] + arr[2]))
ans.append(arr[0] * arr[1] + arr[2])
ans.append(arr[0] * arr[1] * arr[2])
print(max(ans))


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = a * (b + c)
z = a * b * c
o = (a + b) * c
p = a + b + c
m = max(x, y)
n = max(z, o)
t = max(m, n)
s = max(t, p)
print(s, '\n')


a = int(input())
b = int(input())
c = int(input())
x = a + b + c
y = (a + b) * c
h = a * b * c
q = a + b * c
w = a * (b + c)
e = a * b + c
ans = list()
ans.extend([x, y, h, q, w, e])
ans.sort()
print(ans[-1])


__author__ = 'hamed1soleimani'
a = int(input())
b = int(input())
c = int(input())
out = list()
out.append(a + b * c)
out.append(a * b + c)
out.append(a + b + c)
out.append(a * b * c)
out.append(a * (b + c))
out.append((a + b) * c)
print(max(out))


a = int(input())
b = int(input())
c = int(input())
lista = []
lista.append(a + b + c)
lista.append(a * b * c)
lista.append(a * (b + c))
lista.append((a + b) * c)
lista.append(a + b * c)
lista.append(a * b + c)
print(max(lista))


a = int(input())
b = int(input())
c = int(input())
newlist = []
newlist.append(a + b * c)
newlist.append(a * (b + c))
newlist.append(a * b * c)
newlist.append((a + b) * c)
newlist.append(a + b + c)
print(max(newlist))


a = int(input())
b = int(input())
c = int(input())
caseA = a + b * c
caseB = a * b + c
caseC = a * b * c
caseD = (a + b) * c
caseE = a * (b + c)
caseG = a + b + c
max = caseA
if caseB > max:
	max = caseA
if caseC > max:
	max = caseC
if caseD > max:
	max = caseD
if caseE > max:
	max = caseE
if caseG > max:
	max = caseG
print(max)


a = int(input())
b = int(input())
c = int(input())
if a == 1 or b == 1:
	m = max((a + b) * c, a + b + c)
else:
	m = max(a * b * c, a * b + c)
if b == 1 or c == 1:
	m = max(m, a * (b + c), a + (b + c))
else:
	m = max(m, a + b * c, a * b * c)
print(m)


a = int(input())
b = int(input())
c = int(input())
d = []
d.append(a + b + c)
d.append(a * b * c)
d.append(a + b * c)
d.append(a * b + c)
d.append((a + b) * c)
d.append(a * (b + c))
d.sort()
print(d[5])


a = int(input())
b = int(input())
c = int(input())
greatest = 0
if a + b + c > greatest:
	greatest = a + b + c
if a * b * c > greatest:
	greatest = a * b * c
if a + b * c > greatest:
	greatest = a + b * c
if (a + b) * c > greatest:
	greatest = (a + b) * c
if a * b + c > greatest:
	greatest = a * b + c
if a * (b + c) > greatest:
	greatest = a * (b + c)
print(greatest)


a = int(input())
b = int(input())
c = int(input())
d = (a + b) * c
e = a * (b + c)
f = a + b + c
g = a * b * c
max = 0
l = [d, e, f, g]
i = 0
while i < 3:
	temp = 0
	if l[i] > l[i + 1]:
		temp = l[i + 1]
		l[i + 1] = l[i]
		l[i] = temp
	i += 1
print(l[3])


def solve(a, b, c):
	if a == 0:
		if b == 0:
			s = A + B
		else:
			s = A * B
		if c == 0:
			return s + C
		else:
			return s * C
	else:
		if c == 0:
			s = B + C
		else:
			s = B * C
		if b == 0:
			return s + A
		else:
			return s * A
A = int(input())
B = int(input())
C = int(input())
Max = 0
for i in range(2):
	for j in range(2):
		for k in range(2):
			Max = max(Max, solve(i, j, k))
print(Max)


t = [0, 0, 0]
for a in range(3):
	t[a] = int(input())
total = []
total.append(t[0] * (t[1] + t[2]))
total.append((t[0] + t[1]) * t[2])
total.append(t[0] * (t[1] * t[2]))
total.append(t[0] + t[1] + t[2])
print(max(total))


a = int(input())
b = int(input())
c = int(input())
if a == 1 or b == 1 or c == 1:
	temp1 = a + b + c
	temp2 = (a + b) * c
	temp3 = (b + c) * a
	print(max(temp1, temp2, temp3))
else:
	print(a * b * c)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
from sys import stdin, stdout
input = stdin.readline

def MAP():
	return map(int, input().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def main():
	num = []
	for i in range(3):
		num.append(int(input()))
	MAX = sum(num)
	if num[0] * (num[1] + num[2]) > MAX:
		MAX = num[0] * (num[1] + num[2])
	if (num[0] + num[1]) * num[2] > MAX:
		MAX = (num[0] + num[1]) * num[2]
	if num[0] * num[1] * num[2] > MAX:
		MAX = num[0] * num[1] * num[2]
	print(MAX)
main()


num = []
sum = 0
for i in range(0, 3):
	n = int(input())
	num.append(n)
	sum += n
max1 = max(sum, num[0] * num[1] * num[2], (num[0] + num[1]) * num[2], num[0] * (num[1] + num[2]))
print(max1)


a = int(input(''))
b = int(input(''))
c = int(input(''))
sum = a + b + c
multipl = a * b * c
result1 = (a + b) * c
result2 = a * (b + c)
print(max(sum, multipl, result1, result2))


a = int(input())
b = int(input())
c = int(input())
tt = a + b + c
tt1 = a + b + c
tt2 = a + (b + c)
tt3 = a * b + c
tt4 = a + b * c
tt5 = a * (b + c)
tt6 = (a + b) * c
tt7 = a * b * c
print(max([tt, tt1, tt2, tt3, tt4, tt5, tt6, tt7]))


a = int(input())
b = int(input())
c = int(input())
res = 0
arr = []
arr.append(a * b * c)
arr.append(a + b + c)
arr.append(a + b * c)
arr.append(a * b + c)
arr.append(a * (b + c))
arr.append((a + b) * c)
maxim = max(arr)
print(maxim)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
a = int(z())
b = int(z())
c = int(z())
t1 = (a + b) * c
t2 = 0
t3 = (b + c) * a
t4 = a * b * c
t5 = a + b + c
print(max(t1, t2, t3, t4, t5))


a = int(input())
b = int(input())
c = int(input())
x = a + b * c
y = (a + b) * c
z = a * b * c
u = a * b + c
v = a + b + c
s = a * (b + c)
print(max(x, y, z, u, v, s))


(a, b, c) = (int(input()), int(input()), int(input()))
j = []
j.append((a + b) * c)
j.append(a + b * c)
j.append(a + b + c)
j.append(a * b * c)
j.append(a * (b + c))
print(max(j))


a = int(input())
b = int(input())
c = int(input())
posibles = []
posibles.append(a + b + c)
posibles.append(a * b + c)
posibles.append(a + b * c)
posibles.append((a + b) * c)
posibles.append(a * (b + c))
posibles.append(a + b + c)
posibles.append(a * b * c)
print(max(posibles))


def max_ans(a, b, c):
	sum_boi = a + b + c
	prod_boi = a * b * c
	mult_1 = a * b + c
	mult_2 = a + b * c
	add_1 = (a + b) * c
	add_2 = a * (b + c)
	return max(sum_boi, prod_boi, mult_1, mult_2, add_1, add_2)
a = int(input())
b = int(input())
c = int(input())
print(max_ans(a, b, c))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
a = int(input())
b = int(input())
c = int(input())
ans = max(a * b * c, a + b * c, a * b + c, a + b + c, (a + b) * c, a * (b + c))
print(ans)


print(max((eval(l + a + o + L + b + r + p + c + R) for (a, b, c) in [[input(), input(), input()]] for o in '+*' for p in '+*' for (l, r) in ['()', '  '] for (L, R) in ['()', '  '])))


a = int(input())
b = int(input())
c = int(input())
num = set()
n1 = a * b * c
num.add(n1)
n2 = a * b + c
num.add(n2)
n3 = a * (b + c)
num.add(n3)
n4 = a + b * c
num.add(n4)
n5 = (a + b) * c
num.add(n5)
n6 = a + b + c
num.add(n6)
print(max(num))


a = int(input())
b = int(input())
c = int(input())
num = []
A = a + b * c
num.append(A)
B = a * (b + c)
num.append(B)
C = a * b * c
num.append(C)
D = (a + b) * c
num.append(D)
E = a + b + c
num.append(E)
print(max(num))


list = []
for i in range(3):
	t = int(input())
	list.append(t)
print(max(list[0] * list[1] * list[2], list[0] * (list[1] + list[2]), (list[0] + list[1]) * list[2], list[0] * list[1] + list[2], list[0] + list[1] + list[2]))


a = int(input())
b = int(input())
c = int(input())
s = []
m1 = a + b + c
s.append(m1)
m2 = a * b * c
s.append(m2)
m3 = a * (b + c)
s.append(m3)
m4 = (a + b) * c
s.append(m4)
print(max(s))


li = []
for i in range(3):
	li.append(int(input()))
(a, b, c) = (li[0], li[1], li[2])
li = []
li.append((a + b) * c)
li.append(a * b * c)
li.append(a + b + c)
li.append(a * (b + c))
li.append(a + b * c)
li.append(a * b + c)
print(max(li))


n1 = int(input())
n2 = int(input())
n3 = int(input())
maxSum = 0
val = n1 + n2 + n3
maxSum = max(maxSum, val)
val = n1 * (n2 + n3)
maxSum = max(maxSum, val)
val = n1 + n2 * n3
maxSum = max(maxSum, val)
val = n1 * n2 * n3
maxSum = max(maxSum, val)
val = (n1 + n2) * n3
maxSum = max(maxSum, val)
val = n1 * n2 + n3
maxSum = max(maxSum, val)
print(maxSum)


a = int(input())
b = int(input())
c = int(input())
re = []
re.append(a + b * c)
re.append(a * (b + c))
re.append(a * b * c)
re.append((a + b) * c)
re.append(a + b + c)
print(max(re))


l = []
ans = []
num = 0
for i in range(3):
	s = int(input())
	l.append(s)
ans.append(l[0] + l[1] + l[2])
if 1 in l:
	ans.append(max((l[0] + l[1]) * l[2], l[0] * (l[1] + l[2])))
else:
	ans.append(l[0] * l[1] * l[2])
print(max(ans))


import math
import os
import random
import re
import sys
a = int(input())
b = int(input())
c = int(input())
d1 = a + b * c
d2 = a * (b + c)
d3 = a * b * c
d4 = (a + b) * c
d5 = a + b + c
d = max(d1, d2, d3, d4, d5)
print(d)


a = [int(input()) for i in range(3)]
r_max = 0
for op1 in [int.__mul__, int.__add__]:
	for op2 in [int.__mul__, int.__add__]:
		for p in [0, 1]:
			r_max = max(r_max, op2(op1(a[p], a[p + 1]), a[(1 - p) * 2]))
print(r_max)


a = []
for i in range(3):
	a.append(int(input()))
dp = [[-1 for i in range(3)] for j in range(3)]

def f(i, j):
	if dp[i][j] != -1:
		return dp[i][j]
	elif i == j:
		return a[i]
	res = 0
	for k in range(i, j):
		res = max(res, f(i, k) + f(k + 1, j), f(i, k) * f(k + 1, j))
	dp[i][j] = res
	return res
print(f(0, 2))


x = int(input())
y = int(input())
z = int(input())
temp = [x * y * z, x * (y + z), (x + y) * z, x + y + z]
maks = 0
for i in range(len(temp)):
	if temp[i] > maks:
		maks = temp[i]
print(maks)


def main():
	from sys import stdout
	a = int(input())
	b = int(input())
	c = int(input())
	if a == c == 1:
		res = a + b + c
	elif a == 1:
		res = (a + b) * c
	elif c == 1:
		res = a * (b + c)
	elif b == 1:
		if a < c:
			res = (a + b) * c
		else:
			res = a * (b + c)
	else:
		res = a * b * c
	stdout.write(str(res))
main()


f = int(input())
s = int(input())
t = int(input())
print(max(f * s * t, f + s + t, f + s * t, f * s + t, (f + s) * t, f * (s + t)))


a = int(input())
b = int(input())
c = int(input())
if a == 1 and b == 1 and (c == 1):
	value = 3
elif a == 1 and c == 1:
	value = 2 + b
elif a == 1:
	value = (a + b) * c
elif b == 1:
	x = a + b
	y = b + c
	res1 = x * c
	res2 = a * y
	value = max(res1, res2)
elif c == 1:
	value = a * (b + c)
else:
	value = a * b * c
print(value)


a = int(input())
b = int(input())
c = int(input())
Res_1 = (a + b) * c
Res_2 = a * (b + c)
Res_3 = a * b * c
Res_4 = a + b + c
maximum = max(Res_1, Res_2, Res_3, Res_4)
print(maximum)


x = ['a+b+c', 'a*b*c', 'a+b*c', 'a*b+c', '(a+b)*c', 'a*(b+c)']
a = input()
b = input()
c = input()
print(max([eval(i.replace('a', a).replace('b', b).replace('c', c)) for i in x]))


a = int(input())
b = int(input())
c = int(input())
tobeat = 0
if tobeat <= a + b + c:
	tobeat = a + b + c
if tobeat <= a * b * c:
	tobeat = a * b * c
if tobeat <= (a + b) * c:
	tobeat = (a + b) * c
if tobeat <= a * (b + c):
	tobeat = a * (b + c)
print(tobeat)


a = int(input())
b = int(input())
c = int(input())
x1 = [eval('a*b*c'), eval('a+b+c'), eval('(a+b)*c'), eval('a*(b+c)')]
print(max(x1))


def expr(aa, bb, op):
	if op:
		return aa + bb
	else:
		return aa * bb
a = int(input())
b = int(input())
c = int(input())
mx = 0
for i in range(0, 2):
	for j in range(0, 2):
		for k in range(0, 2):
			if k == 0:
				tmp = expr(expr(a, b, i), c, j)
			else:
				tmp = expr(a, expr(b, c, i), j)
			if tmp > mx:
				mx = tmp
print(mx)


a = int(input())
b = int(input())
c = int(input())
m = []
d1 = a + b * c
m.append(d1)
d2 = a * b * c
m.append(d2)
d3 = a * (b + c)
m.append(d3)
d4 = (a + b) * c
m.append(d4)
d5 = a + b + c
m.append(d5)
print(max(m))


a = int(input())
b = int(input())
c = int(input())
maxx = a + b + c
if maxx < a * b * c:
	maxx = a * b * c
if maxx < a * b + c:
	maxx = a * b + c
if maxx < a + b * c:
	maxx = a + b * c
if maxx < (a + b) * c:
	maxx = (a + b) * c
if maxx < a * (b + c):
	maxx = a * (b + c)
print(maxx)


m = int(input())
s = int(input())
k = int(input())
l = [m + s + k, m * s * k, (m + s) * k, m + s * k, m * s + k, m * (s + k)]
print(max(l))


a = int(input())
b = int(input())
c = int(input())
solutions = set()
solutions.add(a + b + c)
solutions.add(a * b * c)
solutions.add(a * (b + c))
solutions.add((a + b) * c)
solutions.add(a * b + c)
solutions.add(a + b * c)
print(max(solutions))


largest = 0
(a, b, c) = (int(input()), int(input()), int(input()))
if a + b + c > largest:
	largest = a + b + c
if a * b * c > largest:
	largest = a * b * c
if a + b * c > largest:
	largest = a + b * c
if (a + b) * c > largest:
	largest = (a + b) * c
if a * b + c > largest:
	largest = a * b + c
if a * (b + c) > largest:
	largest = a * (b + c)
print(largest)


k = []
for i in range(0, 3):
	k.append(int(input()))
a = k[0]
b = k[1]
c = k[2]
j = a + b + c
k = a * b * c
m = a + b * c
n = a * b + c
p = (a + b) * c
q = a * (b + c)
compare = [j, k, m, n, p, q]
print(max(compare))


def f(l):
	(a, b, c) = l
	return max(a + b + c, a * b * c, a * (b + c), (a + b) * c)
l = [int(input()) for _ in range(3)]
print(f(l))


def NormalSum(list):
	return sum(list)

def OneOne(list):
	if list[0] == 1 or list[-1] == 1:
		now = 1 + list[1]
		list.pop(1)
		list.remove(1)
		now *= list[0]
		return now
	elif list[1] == 1:
		list.remove(1)
		now = 1 + min(list)
		list.remove(min(list))
		now *= list[0]
		return now

def NormalMul(list):
	return list[0] * list[1] * list[2]
n1 = int(input())
n2 = int(input())
n3 = int(input())
my_list = [n1, n2, n3]
if my_list[0] == 1 and my_list[1] == 1 and (my_list[2] == 1):
	print(NormalSum(my_list))
elif my_list[0] == 1 and my_list[-1] == 1:
	print(NormalSum(my_list))
elif my_list.count(1) == 0:
	print(NormalMul(my_list))
else:
	print(OneOne(my_list))


a = int(input())
b = int(input())
c = int(input())
sum = 0
if a == 1:
	sum = a + b
	if c == 1:
		sum += c
	else:
		sum *= c
elif b == 1:
	if a < c:
		sum = a + b
		if c == 1:
			sum += c
		else:
			sum *= c
	else:
		sum = b + c
		if a == 1:
			sum += a
		else:
			sum *= a
elif c == 1:
	sum = c + b
	if a == 1:
		sum += a
	else:
		sum *= a
else:
	sum = a * b * c
print(sum)