fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val n: Long = line.toLong()
    val line2 = readLine()!!.trim()
    val nums: List<Long> = line2.split(" ").map {it.toLong()}.take(n.toInt())

    var prod: Long = 1L

    var maxNum: Long = 1L
    for (i in (0..17)) {
        maxNum *= 10L
    }

    if (nums.size == 0 || nums.contains(0L)) {
        prod = 0L
    } else {
        for (i in nums) {

            // val resultKeta: Int = result.toString().length
            // val iKeta: Int = i.toString().length

            if (i > maxNum / prod) {
                prod = -1
                break
            }

            prod *= i
        }

    }


    println(prod)
}