input();s=0 for i,x in enumerate(list(map(int,input().split()))): if x<0 and i!=0:x*=-1 if x<2 or s<2:s+=x else: s*=x print(s)