myProd :: Integer -> Integer -> Integer
myProd _ 0 = 0
myProd 0 _ = 0
myProd _ (-1) = -1
myProd x y
    | y > 10 ^ 18 = -1
    | otherwise   = x * y

solve :: [Integer] -> Integer
solve xs = foldr1 myProd (1:xs)

main :: IO ()
main = do
    getLine
    getLine >>= return . solve . map read . words >>= print
