import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

main = do
  BS.getLine
  li <- BS.getLine
  let as = unfoldr (BS.readInt . BS.dropWhile isSpace) li
  let p = compute as
  print p

lim = 10^18

compute :: [Int] -> Integer
compute as = if head as1 == 0 then 0 else loop 1 (reverse as)
  where
    as1 = sort as
    loop x [] = if x > lim then -1 else x
    loop x (a:as) = if xa > lim then -1 else loop xa as
      where
        xa = x * fromIntegral a