let N = Int(readLine()!)!
var product = 1
let nums: [Int] = readLine()!.split(separator: " ").map { Int($0)! }

for i in 0..<N {
  if String(product).count + String(nums[i]).count - 1 > 19 {
    product = -1
    break
  }
  product *= nums[i]
  if product > 1000000000000000000 {
    product = -1
    break
  }
}
print(product)