import Control.Monad
import Data.List

main = do
    n <- readLn :: IO Int
    ta <- replicateM n $ do
            [t,a] <- map read . words <$> getLine :: IO [Int]
            return (t,a)
    let f (x,y) (t,a) = (k*t, k*a)
            where k = max ((x-1) `div` t + 1) ((y-1) `div` a +　1)
    let (x, y) = foldl' f (1,1) ta
    print $ x + y