program abc169b
   integer :: n, i
   integer(8), allocatable :: a(:)
   integer(8) :: ans, limit=10**9

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

   ans = a(1)
   do i = 2, n
      ans = ans * a(i)
   enddo

   limit = limit**2
   if (ans > limit ) then
      print *, -1
   else
      print *, ans
   end if
end program abc169b
