program main
  implicit none
  integer(8) i, N, ans, lim, frag, frag2
  integer(8),allocatable :: A(:)
  read(*, *)N
  allocate(A(N))
  read(*, *) (A(i), i = 1,N)
  ans = 1
  lim = 1
  frag = 0
  frag2 = 1
  do i = 1,18
    lim = lim * 10
  end do
  !lim = 10**18
  do i = 1,N
    ans = ans*A(i)
    if (ans > lim) then
      frag = 1
    endif
    if (A(i) == 0) then
      frag2 = 0
    endif
  end do
  !frag = frag * frag2
  if (frag == 1) then
    ans = -1
  end if
  if (frag2 == 0) then
    ans = 0
  end if
  write(*, *) ans
end program main
