program mp2
  implicit none
  integer(16) :: N, i
  integer(16),allocatable :: a(:)
  integer(16) :: r

  read(*,*) N
  allocate(a(N))
  read(*,*) a

  r = 1_16
  do i = 1, N
     if (a(i) == 0) then
        write(*,*) 0
     end if
     stop
  end do
  
  do i = 1, N
     if (a(i) > 10_16**18_16) then
        write(*,*) -1
        stop
     else
        r = r * a(i)
        if (r > 10_16**18_16) then
           write(*,*) -1
           stop
        end if
     end if
  end do
  write(*,*) r
  stop
end program mp2
