main = do
  n <- readLn :: IO Int
  dat <- getContents >>= return . map ((\(t:a:_) -> (t,a)) . map read . words) . lines :: IO [(Int, Int)]

  print $ (\(a,b) -> a+b) $ foldl solve (1,1) dat

    where
      solve (t,a) (tr,ar)
        | t'*ar < a = (a'*tr, a'*ar)
        | a'*tr < t = (t'*tr, t'*ar)
        | otherwise = if a' < t' then (a'*tr, a'*ar) else (t'*tr, t'*ar)
        where
          t' = ceiling $ (fromIntegral t) / (fromIntegral tr)
          a' = ceiling $ (fromIntegral a) / (fromIntegral ar)
