import kotlin.math.pow

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()

    var result: Long = 1
    val max = 10.0.pow(18).toLong()

    readLine()!!.split(" ").map(String::toLong).let { numbers ->
        numbers.forEach { number ->
            if (number == 0L) {
                println(0)
                return
            }
        }
        numbers.forEach { number ->
            val tmp = result
            result *= number
            if (number > max || result > max || result / number != tmp) {
                println(-1)
                return
            }
        }
    }
    println(result)
}