from bisect import * N = int(input()) A = list(map(int, input().split())) Q = {A[0]} for a in A[1:]: Q2 = set() while Q: x = next(iter(Q)) Q.remove(x) Q2.add(x + a) Q2.add(x - a) Q2.add(x * a) if a != 0: if x * a > 0: Q2.add(x // a) else: Q2.add(-((-x)//a)) Q = Q2 print(Q) print(max(list(Q)))