import java.io.PrintWriter
import java.lang.Exception
import kotlin.math.pow

// Helper
private val pw = PrintWriter(System.out)
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readLongs() = readStrings().map(String::toLong)
private fun readDoubles() = readStrings().map(String::toDouble)
private fun readStrings2() = readLn().split("").filter { it.isNotEmpty() }
private fun readInts2() = readStrings2().map(String::toInt)
private fun initArray(n:Int, v:String) = Array(n) { v }
private fun initIntArray(n:Int, v:Int) = IntArray(n) { v }
private fun println(value : Any) = pw.println(value)

internal fun abc169b() {
    val N = readInt()
    val A = readLongs()
    val sup = 10.0.pow(18.0).toLong()
    var ans = A[0]
    if(A.indexOf(0L) > 0) {
        println(0)
        return
    }
    try {
        for (i in 1 until N) {
            if(isOverflow(ans, A[i])) {
                throw Exception("overflow")
            }
            ans *= A[i]
        }
        if(ans > sup) throw Exception("over")
        println(ans.toLong().toString())
    } catch (e: Exception) {
        println(-1)
    }
}

internal fun isOverflow(a:Long, b:Long): Boolean {
    val prod = a * b
    return (prod / b != a)
}

fun main(args: Array<String>) {
    abc169b()
    pw.flush()
}
