import Control.Monad
import Data.Int

fn :: ( (Int64, Int64) -> Int64 -> Int64) -> (Int64, Int64) -> Int64 -> Maybe (Int64, Int64)
fn f (a, b) m
  | a <= x && x <= b = Just (x, x + m - 1)
  | otherwise = Nothing
  where x = f (a, b) m

greatest :: (Int64, Int64) -> Int64 -> Maybe (Int64, Int64)
greatest = fn $ \(_, b) m -> m * (b `div` m)

least :: (Int64, Int64) -> Int64 -> Maybe (Int64, Int64)
least = fn $ \(a, _) m -> m * ( (a + m - 1) `div` m)

main = do
  getLine
  a <- fmap (reverse . fmap read . words) getLine
  let l = fmap fst $ foldM least (2, 2) a
  let Just g = fmap snd $ foldM greatest (2, 2) a
  putStrLn $ case l of
    Nothing -> "-1"
    Just x -> unwords $ [show x, show g]