module Main where

unMaybe :: Maybe Int -> Int
unMaybe Nothing = -1
unMaybe (Just a) = a

maybeFold :: (a -> a -> Maybe a) -> a -> [a] -> Maybe a
maybeFold op acc (x:xs) = case op acc x of
	Nothing -> Nothing
	Just a -> maybeFold op a xs
maybeFold op acc [] = Just acc

maybeMul :: Int -> Int -> Maybe Int
maybeMul a b = case a * b < 10^18 of
	True -> Just $ a * b
	False -> Nothing

catchZero :: [Int] -> [Int]
catchZero ns = case 0 `elem` ns of
	True -> [0]
	False -> ns

main :: IO ()
main = do
	nS <- getLine
	let n = read nS
	interact 	$ show
				. unMaybe
				. maybeFold (maybeMul) 1
				. catchZero
				. map (read) 
				. take n 
				. words

