import Foundation


func solution() -> String {
   _ = readLine()
   let AB = readLine()!.components(separatedBy: " ")
   var UpperFlag = false
   
   if AB.contains("0") { return "0" }
   
   let result = AB.reduce("") { (StringNum1, StringNum2) -> String in
      
      if StringNum1 == "" { return StringNum2 }
      
      let num1 = NSDecimalNumber(string: StringNum1)
      let num2 = NSDecimalNumber(string: StringNum2)
      
      if num1.multiplying(by: num2).stringValue.count >= 19 {
         UpperFlag = true
      }
      
      return num1.multiplying(by: num2).stringValue
   }
   
   if UpperFlag {
      if result == "1000000000000000000" { return result}
      return "-1"
   }
   return result
}


print(solution())