#include #include #include using namespace std; using mint=atcoder::modint998244353; const int mod=mint::mod(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin>>N>>M; if(N&1){cout<<0<inv(N+2),C(N+1); inv[1]=1; for(int i=2;i<=N+1;i++)inv[i]=mod-inv[mod%i]*(mod/i); C[0]=1; for(int i=0;i>F; for(;M--;) { int l,r; cin>>l>>r; int a=r-l+1; if(a&1)continue; a/=2; vectorf(a+1); f[0]=1; f[a]=-C[a]; F.emplace_back(f); } auto dfs=[&](auto& dfs, int l, int r)->vector { if(F.empty())return {1}; if(l+1==r)return F[l]; int m=(r+l)/2; return atcoder::convolution(dfs(dfs,l,m),dfs(dfs,m,r)); }; auto f=dfs(dfs,0,F.size()); mint ans=0; for(int i=0;i