#define MD 998244353 ll@n,@k,a[n]{}; rep(k){ ll@l,@s; rep(l){ ll@b--; a[b]|=s; } } wt(Mint(sum(a(n)))/2);