program multi2
  implicit none

  integer(16), allocatable :: a(:)
  integer(16) :: n, i, ans
  integer(16), parameter :: l = 10 ** 18_16

  read(*,*) n

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

  ans = 1
  do i = 1, n
     ans = ans * a(i)
     if(ans > l) then
        write(*,*) -1
        exit
     end if

  end do


  write(*,*) ans
  
  deallocate(a)

  stop
end program multi2



