{-# LANGUAGE TypeApplications #-}
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

bsToInt :: BS.ByteString -> Int
bsToInt = fst . fromJust . BS.readInt

main :: IO ()
main = do
 n <- bsToInt <$> BS.getLine
 as <- map (read @Int . BS.unpack) . BS.words <$> BS.getLine
 print $ loop as 1
   where
     loop as 0 = 0
     loop [] ans = if ans > 10 ^ 18 then -1 else ans
     loop (a:as) ans = loop as (ans * a)