main = do
    n <- read<$>getLine
    a <- map (read :: String -> Integer).words<$>getLine
    putStrLn.show$solve n a

solve :: Int -> [Integer] -> Integer
solve n a = if ken > 1000000000000000000 then -1 else ken
    where
        ken = ke n a 0

ke :: Int -> [Integer] -> Int -> Integer
ke n a i = if i < n - 1 then (ke n a (i+1)) * (a!!i) else a!!i