input() ls = [int(x) for x in input().strip().split()] min_ = ls[0] max_ = ls[0] def sign(x): return x >= 0 def div(lhs, rhs): if sign(lhs) == sign(rhs): return abs(lhs) // abs(rhs) else: return - (abs(lhs) // abs(rhs)) for x in ls[1:]: cand = [ min_ + x, max_ + x, min_ - x, max_ - x, min_ * x, max_ * x, ] if x != 0: cand.append(div(min_, x)) cand.append(div(max_, x)) min_ = min(cand) max_ = max(cand) print(max_)