fun main() = Thread(null, ::abc169b, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc169b() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }

    if (aList.contains(0)) return println(0)

    val max = 1000000000000000000L

    var answer = aList.first()

    for (a in aList.drop(1)) {
        if (answer > 0 && max / answer < a && max / a < answer)
            return println(-1)
        answer *= a
        if (answer > max)
            return println(-1)
    }

    println(answer)
}
