// g++ 1.cpp -std=c++17 -O2 -I . #include using namespace std; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) using mint = modint998244353; int op(int a,int b){ return (int)a+b; } int e(){ return 0; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll n,k;cin>>n>>k; mint ans=0; ans=((n-k)*(n-k-1)); ans/=4; vi v(n,-1),x(n,1); rep(i,0,k){ int p,q;cin>>p>>q; p--;q--; v[q]=p; x[p]=0; } mint now=0; segtree seg(n),seg2(x); per(i,n-1,0){ if(v[i]==-1){ ans+=now; // ? - fix } else{ ans+=seg.prod(0,v[i]); seg.set(v[i],1); //now+=(mint)seg2.prod(v[i],n)/(n-k); } } now=0; rep(i,0,n){ if(v[i]==-1){ ans+=now; // fix - ? } else{ //now+=(mint)seg2.prod(0,v[i])/(n-k); } } rep(i,0,n-k){ ans*=i+1; } cout<