import qualified Data.Vector.Unboxed as VU
import Data.Char
import Debug.Trace

toTuple :: [Double] -> (Double, Double)
toTuple [a, b] = (a, b)

solve xys = let (a, b) = VU.foldl step (1, 1) xys in a + b 
    where
        step :: (Int, Int) -> (Double, Double) -> (Int, Int)
        step (a, b) (x, y) = (m* floor x, m * floor y)
            where
                q = ceiling ((realToFrac a :: Double) / x)
                r = ceiling ((realToFrac b :: Double) / y)
                m = max q r

main = do
    n <- readLn :: IO Int
    tas <- VU.replicateM n (toTuple . map (read :: String -> Double) . words <$> getLine)
    print $ solve tas