readInt :: String -> Int
readInt = read

main = do
 _ <- getLine
 arr <- (map readInt . words) <$> getLine
 case foldr foo' (Just(2,2)) arr of
  Nothing -> print(-1)
  Just (a,b) -> putStrLn(show a++" "++show b)

type Cand = [Int]
type Cand' = (Int,Int)

foo' :: Int -> Maybe Cand' -> Maybe Cand'
foo' divisor Nothing = Nothing
foo' divisor (Just(a,b)) = if lower > upper then Nothing else Just(lower,upper+divisor-1)
 where 
  lower = ((-a)`div`divisor)*(-divisor)
  upper = (b`div`divisor)*divisor
  
  
-- reverse action
foo :: Int -> Cand -> Cand
foo divisor cand = [ c+rem | c <- newcand, rem <- [0..divisor-1] ]
 where newcand = [c | c <- cand, c `mod` divisor == 0]