Buggy python submission (verdict: Time Limit Exceeded):
#ABC169 B-Multiplication2
class Calc():
  def multi(self,x,y):
    x, y, sign, rslt = str(x)+".", str(y)+".",1 ,""
    if x[0]=="-":
      sign*=-1
      x=x[1:]
    if y[0]=="-":
      sign*=-1
      y=y[1:]
    x,y=x.split("."),y.split(".")
    x2 = [int(x[1][-i-1]) for i in range(len(x[1]))] + [int(x[0][-i-1]) for i in range(len(x[0]))]
    y2 = [int(y[1][-i-1]) for i in range(len(y[1]))] + [int(y[0][-i-1]) for i in range(len(y[0]))]
    sum=[0]*(len(x2)+len(y2))
    for i, p in enumerate(y2):
      for j, q in enumerate(x2):
        K=i+j
        sum[K]+=p*q
        while sum[K]>9:
          sum[K+1], sum[K] = sum[K+1] + int(sum[K]/10) , sum[K]%10
          K+=1
    for i in range(len(sum)): rslt+=str(sum[-i-1])
    dclen=len(x[1])+len(y[1])
    if dclen>0: rslt=rslt[:len(rslt)-dclen]+"."+rslt[len(rslt)-dclen:len(rslt)]
    for i in range(len(rslt)):
      if rslt[i]=="0" and (rslt[i+1] if i<len(rslt)-1 else ".")!="." : continue
      else:
        rslt=rslt[max(i,0):]
        break
    return ("-" if sign==-1 else "")+rslt
  
  def max_2(self,x,y):
    X,Y=x,y
    x, y, rslt = str(x)+".", str(y)+".", ""
    if x[0]=="-" and y[0]!="-": return Y
    if x[0]!="-" and y[0]=="-": return X
    if x[0]=="-" and y[0]=="-": return #(略)
    x,y=x.split("."),y.split(".")
    size0,size1 = max(len(x[0]),len(y[0])), max(len(x[1]),len(y[1]))
    x[0],y[0] = "0"*( size0 - len(x[0]) ) + x[0] , "0"*( size0 - len(y[0]) ) + y[0]
    x[1],y[1] = x[1] + "0"*( size1 - len(x[1]) ) , y[1] + "0"*( size1 - len(y[1]) )
    for s in [0,1]:
      for i in range( size0 if s==0 else size1 ):
        p,q=int(x[s][i]),int(y[s][i])
        if p==q: continue
        elif p>q: return X
        elif p<q: return Y
    return X

N=int(input())
A=input().split()
R,lim="1","1"+"0"*17+"1"
for i in range(N): 
  R=Calc().multi(R,A[i])
print( -1 if Calc().max_2(lim,R)==R else R )

Fixed submission:
#ABC169 B-Multiplication2
class Calc():
  def multi(self,x,y):
    x, y, sign, rslt = str(x)+".", str(y)+".",1 ,""
    if x[0]=="-":
      sign*=-1
      x=x[1:]
    if y[0]=="-":
      sign*=-1
      y=y[1:]
    x,y=x.split("."),y.split(".")
    x2 = [int(x[1][-i-1]) for i in range(len(x[1]))] + [int(x[0][-i-1]) for i in range(len(x[0]))]
    y2 = [int(y[1][-i-1]) for i in range(len(y[1]))] + [int(y[0][-i-1]) for i in range(len(y[0]))]
    sum=[0]*(len(x2)+len(y2))
    for i, p in enumerate(y2):
      for j, q in enumerate(x2):
        K=i+j
        sum[K]+=p*q
        while sum[K]>9:
          sum[K+1], sum[K] = sum[K+1] + int(sum[K]/10) , sum[K]%10
          K+=1
    for i in range(len(sum)): rslt+=str(sum[-i-1])
    dclen=len(x[1])+len(y[1])
    if dclen>0: rslt=rslt[:len(rslt)-dclen]+"."+rslt[len(rslt)-dclen:len(rslt)]
    for i in range(len(rslt)):
      if rslt[i]=="0" and (rslt[i+1] if i<len(rslt)-1 else ".")!="." : continue
      else:
        rslt=rslt[max(i,0):]
        break
    return ("-" if sign==-1 else "")+rslt
  
  def max_2(self,x,y):
    X,Y=x,y
    x, y, rslt = str(x)+".", str(y)+".", ""
    if x[0]=="-" and y[0]!="-": return Y
    if x[0]!="-" and y[0]=="-": return X
    if x[0]=="-" and y[0]=="-": return #(略)
    x,y=x.split("."),y.split(".")
    size0,size1 = max(len(x[0]),len(y[0])), max(len(x[1]),len(y[1]))
    x[0],y[0] = "0"*( size0 - len(x[0]) ) + x[0] , "0"*( size0 - len(y[0]) ) + y[0]
    x[1],y[1] = x[1] + "0"*( size1 - len(x[1]) ) , y[1] + "0"*( size1 - len(y[1]) )
    for s in [0,1]:
      for i in range( size0 if s==0 else size1 ):
        p,q=int(x[s][i]),int(y[s][i])
        if p==q: continue
        elif p>q: return X
        elif p<q: return Y
    return X

N=int(input())
A=input().split()
R,lim="1","1"+"0"*17+"1"
if "0" in A: print(0)
else:
  for i in range(N): 
    R=Calc().multi(R,A[i])
    if Calc().max_2(lim,R)==R:
      print(-1)
      break
  else:
    print(R)