import Data.Int (Int64)
import Control.Monad

m :: Int64
m = 10 ^ 18

pr :: Int64 -> Int64 -> Either Int64 Int64
pr a b = let x = a * b in if x > m then Left (-1) else Right x

main :: IO ()
main = do
   _ <- getLine
   xs <- map read . words <$> getLine
   print . either id id $ foldM pr 1 xs
