program multi2
  implicit none

  integer(16), allocatable :: a(:)
  real(16), allocatable :: ar(:), b(:)
  integer(16) :: n, i, ans, l, t
  read(*,*) n

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

  l = 1
  do i = 1, 18
     l = l * 10
  end do

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

     t = 1
  end do

  if (t == 1) then
     write(*,*) ans
  end if

else
   write(*,*) 0
end if

  deallocate(a, ar, b)

  
  stop
end program multi2



