import Control.Monad
import qualified Data.List as L

data Robot = Robot { pos :: Int, dist :: Int } deriving (Show)

data Tree = Tree [Tree]
tree :: Robot -> [Robot] -> (Tree, [Robot])
tree root@(Robot pos dist) robots = (Tree ts, rest) where
  (ts, rest) = treeManyBefore (pos + dist) robots

treeManyBefore :: Int -> [Robot] -> ([Tree], [Robot])
treeManyBefore _ [] = ([], [])
treeManyBefore e (r : rs)
  | pos r < e = (t : ts, rs'') 
  | otherwise = ([], r : rs) 
  where
    (t, rs') = tree r rs
    (ts, rs'') = treeManyBefore e rs'


modP :: Int 
modP = 998244353

modProd :: [Int] -> Int
modProd = foldl (\x y -> (x * y) `mod` modP) 1

evalTrees :: [Tree] -> Int
evalTrees =  modProd . map (\(Tree ts) -> evalTrees ts + 1)

main = do
  n <- readLn
  robots  <- replicateM n $ do
    [x, d] <- (map read . words) <$> getLine
    return $ Robot x d
  let sortedRobots = L.sortOn pos robots
  let ts = fst $ treeManyBefore (pos (last sortedRobots) + 1) sortedRobots
  print $ evalTrees ts
