{-# 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
  print $ (\x -> if x > 10^18 then -1 else x) $ L.foldr (\x acc -> if acc == 0 then 0 else if acc == -1 || acc > 10^18 then -1 else x * acc) 1 xs
