import Control.Applicative
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = getLine >> solve <$> f >>= print
  where
    f = readil B.readInteger <$> B.getLine

solve :: [Integer] -> Integer
solve = foldl f 1
  where
    f (-1) 0 = 0
    f (-1) _ = (-1)
    f m x = let mx = m * x in
              if mx > 1000000000000000000 then (-1) else mx

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr $ \s -> do
  (n, s') <- f s
  return (n, B.dropWhile isSpace s')
