module Main where

import Control.Applicative

main :: IO ()
main = do
  n <- getLine
  lst <- map (map read . words) . lines <$> getContents
  print $ solve lst 1 1

solve :: [[Integer]] -> Integer -> Integer -> Integer
solve [] t a = t + a
solve ([t,a]:xs) u b =
  let mx = max (u `divceil` t) (b `divceil` a)
  in solve xs (t * mx) (a * mx)
  where
    a `divceil` b = ceiling (fromIntegral a / fromIntegral b)
