program abc169b
  use iso_c_binding
  implicit none

  integer :: n, i
  integer(c_int128_t) :: x, a(100000)
  integer(c_int128_t),parameter :: mx = 10_8**18

  read *, n
  read *, a(1:n)

  if (any(a(1:n) == 0)) then
     print *, 0
     stop
  end if

  x = 1

  do i = 1,n
     x = x * a(i)
     if (x > mx) then
        x = -1
        exit
     end if
  end do

  print *, x
end program abc169b
