package main                                                                                                                                                                                                
                                                                                                                                                                                                              
  import "fmt"                                                                                                                                                                                                
  import "math/big"                                                                                                                                                                                           
                                                                                                                                                                                                              
                                                                                                                                                                                                              
func main() {                                                                                                                                                                                               
      var N int                                                                                                                                                                                               
                                                                                                                                                                                                              
      fmt.Scanf("%d\n", &N)                                                                                                                                                                                   
      a := make([]*big.Int, N)                                                                                                                                                                                
      r := big.NewInt(1)                                                                                                                                                                                      
      t := new(big.Int)                                                                                                                                                                                       
      t.SetString("1000000000000000000", 10)                                                                                                                                                                  
      for i := 0; i < N; i++ {                                                                                                                                                                                
          var s string                                                                                                                                                                                        
          fmt.Scanf("%s", &s)                                                                                                                                                                                 
          if s == "0" {                                                                                                                                                                                       
              fmt.Printf("0\n")                                                                                                                                                                               
              return                                                                                                                                                                                          
          }                                                                                                                                                                                                   
                                                                                                                                                                                                              
          a[i] = new(big.Int)                                                                                                                                                                                 
          a[i].SetString(s, 10)                                                                                                                                                                               
      }                                                                                                                                                                                                       
                                                                                                                                                                                                              
      for i := 0; i < N; i++ {                                                                                                                                                                                
          r.Mul(r, a[i])                                                                                                                                                                                      
          if r.Cmp(t) > 0 {                                                                                                                                                                                   
              fmt.Printf("-1\n")                                                                                                                                                                              
              return                                                                                                                                                                                          
          }                                                                                                                                                                                                   
      }                                                                                                                                                                                                       
      fmt.Printf("%s\n", r.String())                                                                                                                                                                          
  }  

Measured memory_bytes: 11268