#include #include #include using namespace std; using mint=atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin>>N>>M; if(N&1){cout<<0<C(N+1); 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.push_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