import Control.Applicative
import Control.Monad
import Data.List

f :: (Int, Int) -> (Int, Int) -> (Int, Int)
f (t1, a1) (t2, a2) = head as
  where
    as = dropWhile (\(t, a) -> t1 > t || a1 > a)
            [(t2 * i, a2 * i) | i <- [1 .. ]]

main :: IO ()
main = do
    n <- readLn
    tas <- replicateM n $ do
        [t, a] <- fmap read . words <$> getLine :: IO [Int]
        return (t, a)
    let ans = foldl1' f tas
    print $ fst ans + snd ans