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 (0, 0)

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 = head [n | n <- [1..], n * t >= pt]
    na = head [n | n <- [1..], n * a >= pa]
    m = max nt na
