n = int(input()) ans = 0 for x in map(int,input().split(' ')): if abs(x) <= 1 or ans <= 1: ans += abs(x) else: ans *= abs(x) print(ans)