-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE TypeApplications #-}
import Data.Char (isSpace)
import Data.Int (Int64)
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS
import Data.Foldable

safeMul :: Int64 -> Int -> Maybe Int64
safeMul x y = let z = toInteger x * toInteger y
              in if z > 10^18
                 then Nothing
                 else Just $! fromInteger z

main = do
  n <- readLn @Int
  xs <- U.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let has_zero = U.any (== 0) xs
  let result = if has_zero then
                 0
               else
                 case U.foldM safeMul 1 xs of
                   Nothing -> -1
                   Just p -> p
  print result
