output_description: Print the number of possible sets of robots remaining on the number line,
  modulo 998244353.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      X_1 D_1
      :
      X_N D_N
attempt: import sys
  
  sys.setrecursionlimit(2147483647)
  INF = 1 << 60
  MOD = 998244353
  input = lambda: sys.stdin.readline().rstrip()
  
  
  class SegmentTree(object):
      def __init__(self, A, dot, unit):
          n = 1 << (len(A) - 1).bit_length()
          tree = [unit] * (2 * n)
          for i, v in enumerate(A):
              tree[i + n] = v
          for i in range(n - 1, 0, -1):
              tree[i] = dot(tree[i << 1], tree[i << 1 | 1])
          self._n = n
          self._tree = tree
          self._dot = dot
          self._unit = unit
  
      def __getitem__(self, i):
          return self._tree[i + self._n]
  
      def update(self, i, v):
          i += self._n
          self._tree[i] = v
          while i != 1:
              i >>= 1
              self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])
  
      def add(self, i, v):
          self.update(i, self[i] + v)
  
      def sum(self, l, r):
          l += self._n
          r += self._n
          l_val = r_val = self._unit
          while l < r:
              if l & 1:
                  l_val = self._dot(l_val, self._tree[l])
                  l += 1
              if r & 1:
                  r -= 1
                  r_val = self._dot(self._tree[r], r_val)
              l >>= 1
              r >>= 1
          return self._dot(l_val, r_val)
  
  
  from bisect import bisect_left
  
  
  def resolve():
      n = int(input())
      XD = [tuple(map(int, input().split())) for _ in range(n)]
      XD.sort()
      X = [xd[0] for xd in XD]
  
      tree = SegmentTree([-INF] * n, max, -INF)
      for i in range(n - 1, -1, -1):
          x, d = XD[i]
          j = bisect_left(X, x + d)
          tree.update(i, max(j, tree.sum(i + 1, j)))
  
      dp = [0] * (n + 1)
      dp[n] = 1
      for i in range(n - 1, -1, -1):
          dp[i] += dp[i + 1]
          dp[i] += dp[tree[i]]
          dp[i] %= MOD
  
      print(dp[0])
  
  
  resolve()
  
problem_description: Statement
  
  There are N robots numbered 1 to N placed on a number line. Robot i is placed
  at coordinate X_i. When activated, it will travel the distance of D_i in the
  positive direction, and then it will be removed from the number line. All the
  robots move at the same speed, and their sizes are ignorable.
  
  Takahashi, who is a mischievous boy, can do the following operation any number
  of times (possibly zero) as long as there is a robot remaining on the number
  line.
  
    * Choose a robot and activate it. This operation cannot be done when there is a robot moving.
  
  While Robot i is moving, if it touches another robot j that is remaining in
  the range [X_i, X_i + D_i) on the number line, Robot j also gets activated and
  starts moving. This process is repeated recursively.
  
  How many possible sets of robots remaining on the number line are there after
  Takahashi does the operation some number of times? Compute this count modulo
  998244353, since it can be enormous.
samples: [{"input": "2\n    1 5\n    3 3", "output": "3\n    \n\nThere are three possible sets of robots remaining on the number line: \\\\{1,\n2\\\\}, \\\\{1\\\\}, and \\\\{\\\\}.\n\nThese can be achieved as follows:\n\n  * If Takahashi activates nothing, the robots \\\\{1, 2\\\\} will remain.\n\n  * If Takahashi activates Robot 1, it will activate Robot 2 while moving, after which there will be no robots on the number line. This state can also be reached by activating Robot 2 and then Robot 1.\n\n  * If Takahashi activates Robot 2 and finishes doing the operation, the robot \\\\{1\\\\} will remain.\n\n* * *"}, {"input": "3\n    6 5\n    -1 10\n    3 3", "output": "5\n    \n\nThere are five possible sets of robots remaining on the number line: \\\\{1, 2,\n3\\\\}, \\\\{1, 2\\\\}, \\\\{2\\\\}, \\\\{2, 3\\\\}, and \\\\{\\\\}.\n\n* * *"}, {"input": "4\n    7 10\n    -10 3\n    4 3\n    -4 3", "output": "16\n    \n\nNone of the robots influences others.\n\n* * *"}, {"input": "20\n    -8 1\n    26 4\n    0 5\n    9 1\n    19 4\n    22 20\n    28 27\n    11 8\n    -3 20\n    -25 17\n    10 4\n    -18 27\n    24 28\n    -11 19\n    2 27\n    -2 18\n    -1 12\n    -24 29\n    31 29\n    29 7", "output": "110\n    \n\nRemember to print the count modulo 998244353."}]