import Control.Monad

main :: IO ()
main = do
  n <- (read :: String -> Int) <$> getLine
  inputs <- replicateM n getInts
  let ans = solve inputs
  print $ uncurry (+) ans
  
getInts :: IO [Int]
getInts = map read . words <$> getLine

solve :: [[Int]] -> (Int, Int)
solve = foldl (\(a, b) [x, y] ->
                 let v = max ((a + x - 1)`div`x) ((b + y - 1)`div`y) in
                 (v * x, v * y)) (1, 1)
