sim [] ans = ans
sim (a:as) ans = sim as (ans-ans`mod`a)

main :: IO ()
main = do
  _ <- read <$> getLine :: IO Int
  as <- map read.words <$> getLine :: IO [Int]
  let minA = minimum as
      range = map fst $ takeWhile (\(_,a)-> a==2) $ dropWhile (\(_,a)-> a<2) [ (a,ans) | a<-[minA..], let ans=sim as a ]
  if null range
    then putStrLn "-1"
    else putStrLn $ unwords $ map show [head range, last range]
