fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = longList()
    if (a.find { it == 0L } != null) {
        println("0")
        return
    }
    var t = 1L
    val max = 1e18.toLong()
    var prev = 1L
    a.forEach {
        t *= it
        if(prev > t) {
            println("-1")
            return
        }
        if (max < t) {
            println("-1")
            return
        }
        prev = t
    }
    println(t.toString())
}
