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
     r = r * a(i)
     if (r >= 10_16**18_16) then
        write(*,*) -1
        stop
     end if
  end do
  write(*,*) r
  stop
end program mp2
