import sys input = sys.stdin.readline from operator import itemgetter mod=998244353 N=int(input()) LIST=[list(map(int,input().split())) for i in range(N)] Q=[] for b,c in LIST: Q.append((b,c-b+1,1)) Q.append((c+1,c-b+1,2)) Q.sort(key=itemgetter(1)) Q.sort(key=itemgetter(0)) now1=0 ANS1=0 for i in range(len(Q)): x,length,com=Q[i] if com==1: now1+=pow(length,-1,mod) else: now1-=pow(length,-1,mod) now1%=mod if i+1