{-# OPTIONS_GHC -O2 #-}

import qualified Data.List             as L
import qualified Data.Maybe            as Maybe
import qualified Data.ByteString.Char8 as BSC8

readIntegers :: IO [Integer]
readIntegers = map ( fst . Maybe.fromJust . BSC8.readInteger ) . BSC8.words <$> BSC8.getLine

main :: IO ()
main = do
  BSC8.getLine
  xs <- readIntegers
  if elem 0 xs
    then print 0
    else print $ (\x -> if x > 10^18 then -1 else x)
                $ L.foldr1 (\x acc -> if acc == -1 || acc > 10 ^ 18 then -1 else x * acc) xs
