from heapq import heappush, heappop

import sys

input = sys.stdin.readline



mod = 998244353

N = int(eval(input()))

XD = [tuple(map(int, input().split())) for _ in range(N)]

XD.sort(key=lambda x : x[0])

children = [[] for _ in range(N)]

pq = []

for i, (x, d) in list(enumerate(XD))[::-1]:

    while pq and pq[0][0] < x + d:

        y, j = heappop(pq)

        children[i].append(j)

    heappush(pq, (x, i))

val = [0] * N

for i in range(N)[::-1]:

    res = 1

    for j in children[i]:

        res = res * val[j] % mod

    val[i] = res + 1

ans = 1

while pq:

    x, i = heappop(pq)

    ans = ans * val[i] % mod

print(ans)
import sys

input = sys.stdin.readline



mod = 998244353

N = int(eval(input()))

XD = [tuple(map(int, input().split())) for _ in range(N)]

XD.sort(key=lambda x : x[0])

children = [[] for _ in range(N)]

stack = []

for i, (x, d) in list(enumerate(XD))[::-1]:

    while stack and stack[-1][0] < x + d:

        y, j = stack.pop()

        children[i].append(j)

    stack.append((x, i))

val = [0] * N

for i in range(N)[::-1]:

    res = 1

    for j in children[i]:

        res = res * val[j] % mod

    val[i] = res + 1

ans = 1

for x, i in stack:

    ans = ans * val[i] % mod

print(ans)
from heapq import heappush, heappop
import sys

input = sys.stdin.readline
mod = 998244353
N = int(eval(input()))
XD = [tuple(map(int, input().split())) for _ in range(N)]
XD.sort(key=lambda x: x[0])
children = [[] for _ in range(N)]
pq = []
for i, (x, d) in list(enumerate(XD))[::-1]:
    while pq and pq[0][0] < x + d:
        y, j = heappop(pq)
        children[i].append(j)
    heappush(pq, (x, i))
val = [0] * N
for i in range(N)[::-1]:
    res = 1
    for j in children[i]:
        res = res * val[j] % mod
    val[i] = res + 1
ans = 1
while pq:
    x, i = heappop(pq)
    ans = ans * val[i] % mod
print(ans)

import sys

input = sys.stdin.readline
mod = 998244353
N = int(eval(input()))
XD = [tuple(map(int, input().split())) for _ in range(N)]
XD.sort(key=lambda x: x[0])
children = [[] for _ in range(N)]
stack = []
for i, (x, d) in list(enumerate(XD))[::-1]:
    while stack and stack[-1][0] < x + d:
        y, j = stack.pop()
        children[i].append(j)
    stack.append((x, i))
val = [0] * N
for i in range(N)[::-1]:
    res = 1
    for j in children[i]:
        res = res * val[j] % mod
    val[i] = res + 1
ans = 1
for x, i in stack:
    ans = ans * val[i] % mod
print(ans)

-from heapq import heappush, heappop -pq = [] +stack = [] -    while pq and pq[0][0] < x + d: -        y, j = heappop(pq) +    while stack and stack[-1][0] < x + d: +        y, j = stack.pop() -    heappush(pq, (x, i)) +    stack.append((x, i)) -while pq: -    x, i = heappop(pq) +for x, i in stack: