n = int(input()) a = [int(s) for s in input().split()] t = a[0] for i in a[1:]: s = [t+i, t*i, t-i] if i!=0: s+=[t/i] t = max(s) print(t)