import Control.Monad
import Data.Ratio

main :: IO ()
main = do
    n <- readLn
    ratios <- replicateM n getRatio
    print $ minVotes ratios

getRatio :: IO (Int, Int)
getRatio = tuple . map read . words <$> getLine
  where
    tuple [x,y] = (x,y)

minVotes :: [(Int, Int)] -> Int
minVotes = sumVotes . minFinalVotes
  where
    sumVotes (a,b) = a+b

minFinalVotes :: [(Int, Int)] -> (Int, Int)
minFinalVotes = foldl1 f
  where
    f acc (x,y) = let n = coef acc (x,y) in (n*x, n*y)
    coef (a,b) (x,y) = max (ceiling $ a%x) (ceiling $ b%y)