//#i#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <cassert>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

long long pow(long long n, long long p, long long k) {//n^k(mod p)
	if (!k) return 1;
	long long a = pow(n,p, k>>1);
	a = a * a%p;
	if (k & 1) a = a * n%p;
	return a;
}
void euclid(long long &a, long long &b, long long p) { // a>=b A*b+B*(a-a/b*b)=1
	if (a == 1) {
		a = 1;
	}
	else {
		long long A = b, B = a % b;
		euclid(A, B, p);
		b = (A - (p + a / b) % p * B % p + p) % p;
		a = B;
	}
}
long long rev(long long n, long long p) {//nの逆元 n*x-p*y=1
	//long long q = p;
	//euclid(p, n, p);
	//return n % q;
    return pow(n,p,p-2);
}
long long bino(long long n, long long m, long long p) {//nCm(mod p)
	long long ans = 1, div = 1;
	for(int i = 0;i < m; i++){
		ans = (n - i) * ans % p;
		div = div * (i +1) % p;
	}
	return ans * rev(div, p) % p;
}
struct modint {
	long long num;
	long long p;
	modint() {
		num = 0;
		p = 998244353;
	}
	modint(int x) {
		p = 998244353;
		num = (long long)x%p;
	}
	modint(long long x) {
		p = 998244353;
		num = x % p;
	}
	modint operator+(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num + other.num) % p;
		return ret;
	}
	modint operator+(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num + (other%p)) % p;
		return ret;
	}
	modint operator-(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num - other.num + p) % p;
		return ret;
	}
	modint operator-(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num - (other%p) + p) % p;
		return ret;
	}
	modint operator*(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*other.num) % p;
		return ret;
	}
	modint operator*(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*(other%p)) % p;
		return ret;
	}
	modint operator/(const modint &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*rev(other.num, p)) % p;
		return ret;
	}
	modint operator/(const long long &other) {
		modint ret;
		ret.p = p;
		ret.num = (num*rev(other%p, p)) % p;
		return ret;
	}
	void operator+=(const long long &other) {
		num = (num + other) % p;
	}
	void operator+=(const modint &other) {
		num = (num + other.num) % p;
	}
	void operator-=(const long long &other) {
		num = (num - other + p) % p;
	}
	void operator-=(const modint &other) {
		num = (num - other.num + p) % p;
	}
	void operator*=(const long long &other) {
		num = (num*other) % p;
	}
	void operator*=(const modint &other) {
		num = (num*other.num) % p;
	}
};
std::ostream& operator<<(std::ostream &os, const modint &x){
	std::cout << x.num;
	return os;
}

std::ostream& operator<<(std::ostream &os, const Pii &x){
	std::cout << x.first MM x.second;
	return os;
}

struct SegTree{ //0indexed
    std::vector<int> nod;
    int size;
    SegTree(int x){
        size=1;
        while(x>size){
            size*=2;
        }
        nod=std::vector<int>(size*2-1,INT_MIN/2);
    }
    void update(int k,int a){
        k+=size-1;
        nod[k]=a;//最下の処理
        while(k>0){
            k=(k-1)/2;
            nod[k] = std::max(nod[k*2+1], nod[k*2+2]); //下から上へ 
        }
    }
    int query(int a,int b,int k,int l,int r){
        //[a,b)について
        //kは節点の番号,[l,r)はその節点がカバーする範囲
        if(r<=a||b<=l){ //[a,b)と[l,r)が重なって無いとき
            return INT_MIN/2;
        }
        if(a<=l && r<=b){ //[a,b)が[l,r)を完全に含んでいるとき
            return nod[k];
        }
        else{
            return std::max(query(a,b,k*2+1,l,(l+r)/2),query(a,b,k*2+2,(l+r)/2,r));
        }
    }
    void deb(){ //全ノードの出力
		for(int i=0;i<size*2-1;i++){
			if(i==size*2-2){
				std::cout << nod[i] <<std:: endl;
			}
			else{
				std::cout << nod[i] << ' ';
			}
		}
		return;
	}
};

using namespace std;

void interval(vector<Pii> &da, int n){
	SegTree st(n*2);
	vector<Pii> li(n*2);
	rip(i,n,0){
	li[i*2] = mapa(da[i].first, n+i);
	li[i*2+1] = mapa(da[i].first+da[i].second, i);
	}
	sort(all(li));
	for(int i=2*n-1;i>=0;i--){
		if(li[i].second < n){
			da[li[i].second].second = i;
		}
		else{
			da[li[i].second-n].second = max(st.query(i, da[li[i].second-n].second+1, 0, 0, st.size), li[da[li[i].second-n].second].first);
			st.update(i, da[li[i].second-n].second);
		}
	}
	return;
}

int main(){
	int n;cin >>n;
	vector<Pii> da(n);
	rip(i,n,0) cin >> da[i].first >> da[i].second;
	interval(da, n);
	vector<modint> me(n);
	vector<Pii> li(n*2);
	rip(i,n,0){
	li[i*2] = mapa(da[i].first, n+i);
	li[i*2+1] = mapa(da[i].second, i);
	}
	modint non(1);
	//rip(i,n,0) cout << da[i] << "\n";
	sort(all(li));
	rip(i,n*2,0){
		if(li[i].second < n){
			non += me[li[i].second];
		}
		else{
			me[li[i].second-n] = non;
		}
	}
	cout << non << endl;
}

Measured memory_bytes: 9088