
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

rp :: IO (Int,Int)
rp  = toTup . unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

toTup [a,b] = (a,b)



main :: IO ()
main = do
    n <- readLn
    (t,a) <- rp
    res <- loop (t,a) (n-1)
    print res


loop :: (Int,Int) -> Int -> IO Int 
loop (t,a) 0 = return $ t+a
loop (t,a) n = do
    (t',a') <- rp
    let fac = untilGreater' (t',a') (t,a)
    loop (fac*t',fac*a') (n-1)


cl x y = ceiling ((fromIntegral x) / (fromIntegral y) :: Rational)


untilGreater' (a,b) (x,y) = max (cl x a) (cl y b)

