program multiplication2
  implicit none
  integer(16), parameter :: u = 10_16**18
  integer :: n, i
  integer(16) :: a(100000) = 0, x = 1
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    x = x*a(i)
    if (x > u) then
      write(*,'(i0)') -1
      stop
    end if
  end do
  write(*,'(i0)') x
end program multiplication2