import Control.Applicative ((<$>))
import Control.Monad (replicateM)


solve [] a b = a+b
solve ([l,r]:xss) a b =
  let k = maximum [div (a+l-1) l, div (b+r-1) r] in
    solve xss (k*l) (k*r)


main = do
  n <- read <$> getLine :: IO Int
  xss <- fmap (fmap read) <$> fmap words <$> replicateM n getLine :: IO [[Int]]
  putStrLn . show $ solve (tail xss) 1 1