import Control.Monad

main :: IO ()
main = do
  _ <- getLine
  a <- reverse . map read . words <$> getLine
  let ans = foldl po (Just (2, 2)) a
  putStrLn $ case ans of
    Nothing       -> "-1"
    Just (mi, ma) -> unwords $ map show [mi, ma]

po :: Maybe (Int, Int) -> Int -> Maybe (Int, Int)
po range x = do
  (mi, ma) <- range
  guard $ ma >= x
  guard $ mi <= ((ma `div` x) * x)
  let
    nmi = if mi `mod` x == 0     then mi else mi + x - (mi `mod` x)
    nma = if ma `mod` x == x - 1 then ma else ma + x - (ma `mod` x) - 1
  return (nmi, nma)