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
  from bisect import bisect_left
  from operator import itemgetter
  
  
  class SegTreeMax:
      """
      以下のクエリを処理する
      1.update:  i番目の値をxに更新する
      2.get_min: 区間[l, r)の最小値を得る
      """
  
      def __init__(self, n, INF):
          """
          :param n: 要素数
          :param INF: 初期値（入りうる要素より十分に大きな数）
          """
          n2 = 1 << (n - 1).bit_length()
          self.offset = n2
          self.tree = [INF] * (n2 << 1)
          self.INF = INF
  
      def initialize(self, arr):
          for i, v in enumerate(arr, start=self.offset):
              self.tree[i] = v
          for i in range(self.offset - 1, 0, -1):
              j = i << 1
              self.tree[i] = max(self.tree[j], self.tree[j + 1])
  
      def update(self, i, x):
          """
          i番目の値をxに更新
          :param i: index(0-indexed)
          :param x: update value
          """
          i += self.offset
          self.tree[i] = x
          while i > 1:
              y = self.tree[i ^ 1]
              if y >= x:
                  break
              i >>= 1
              self.tree[i] = x
  
      def get_max(self, a, b):
          """
          [a, b)の最大値を得る
          :param a: index(0-indexed)
          :param b: index(0-indexed)
          """
          result = self.INF
  
          l = a + self.offset
          r = b + self.offset
          while l < r:
              if r & 1:
                  result = max(result, self.tree[r - 1])
              if l & 1:
                  result = max(result, self.tree[l])
                  l += 1
              l >>= 1
              r >>= 1
  
          return result
  
  
  n, *xd = map(int, sys.stdin.buffer.read().split())
  MOD = 998244353
  xd = sorted(zip(xd[0::2], xd[1::2]))
  xxx = list(map(itemgetter(0), xd))
  ans = [0] * (n + 1)
  skip = list(range(1, n + 1))
  ans[n] = 1
  sgt = SegTreeMax(n + 1, 0)
  sgt.initialize(list(range(1, n + 2)))
  for i in range(n - 1, -1, -1):
      x, d = xd[i]
      r = x + d
      j = bisect_left(xxx, r)
      k = sgt.get_max(i, j)
      ans[i] = (ans[i + 1] + ans[k]) % MOD
      sgt.update(i, k)
  print(ans[0])
  
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."}]