import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInteger
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

main = do
  getLine 
  a <- getIntList
  if elem 0 a 
    then print 0
    else print $ get $ solve a 1


mul :: Integer -> Integer -> Maybe Integer
mul n m
  | n*m <= 1000000000000000000 = Just (n*m)
  | otherwise = Nothing 

get :: Maybe Integer -> Integer
get (Just n) = n
get Nothing  = -1      

solve :: [Integer] -> Integer -> Maybe Integer
solve [] cur = Just cur
solve (fa:sa) cur = do
  p <- mul cur fa
  solve sa p

      
      
