#include #include #include #include #include #include #include using namespace std; using mint=atcoder::modint998244353; struct dat{ mint sum; mint len; }; dat op(dat l,dat r){return dat{l.sum+r.sum,l.len+r.len};} dat e(){return dat{mint::raw(0),mint::raw(0)};} dat mp(mint f,dat x) { x.sum+=f*x.len; return x; } mint cmp(mint f,mint g){return f+g;} mint id(){return mint::raw(0);} int N; int L[2<<17],R[2<<17]; int main() { cin>>N; vectorvs; for(int i=0;i>L[i]>>R[i]; vs.push_back(L[i]); vs.push_back(R[i]+1); } if(N==1) { cout<<0<init(vs.size()-1); for(int i=0;i+1seg(init); for(int i=0;i