import Control.Monad

main :: IO ()
main = do
  n <- readLn
  l <- replicateM n $ do
    [t, a] <- map read . words <$> getLine
    return (t, a)
  print $ uncurry (+) $ solve l (1, 1)

solve :: [(Int, Int)] -> (Int, Int) -> (Int, Int)
solve [] (t, a) = (t, a)
solve ((t, a):xs) (pt, pa) = solve xs (m * t, m * a)
  where
    nt = if pt `mod` t == 0 then pt `div` t else pt `div` t + 1
    na = if pa `mod` a == 0 then pa `div` a else pa `div` a + 1
    m = max nt na
