import java.lang.ArithmeticException

fun main() {
	val n = readLine()!!.toInt()
	val a = readLine()!!.split(" ").map {it.toLong()}
	var r = 1L
	if(a.contains(0L)) {
		println(0)
		return
	}
	try {
		for(i in a)
			r = Math.multiplyExact(r,i)
		if(r>1000_000_000_000_000_000)
			throw ArithmeticException()
	} catch(e:ArithmeticException) {
		println(-1)
		return
	}
	println(r)
}
