import Foundation

func readInts() -> [Int] {
   return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let _ = Int(readLine()!)!
    let numbers = readInts()
    var ans = 1

    if numbers.contains(0){
        print(0)
        return
    }
    for n in numbers {
        let(partia,isOverFlow) = ans.multipliedReportingOverflow(by: n)
        if isOverFlow || partia > 1000000000000000000 {
            print(-1)
            return
        }
        ans *= n
    }
    print(ans)
}
main()

