import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.NoSuchElementException; public class Main implements Runnable { //Runnableを実装する public static void main(String[] args) { new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start(); //16MBスタックを確保して実行 } public void run() { solve(); } final long mod=998244353; class Query implements Comparable { int l; int r; int p; long x; int id; public Query(int l, int r, int p, long x, int id) { this.l=l; this.r=r; this.p=p; this.x=x; this.id=id; } int reverseOrder() { int b=0; for (int i=17;i>=0;--i) { b|=((p>>i)%2)<<(17-i); } return b; } @Override public int compareTo(Main.Query o) { return Integer.compare(reverseOrder(), o.reverseOrder()); } } class SegTree { long[][] f; int[] l_pointer; int[] r_pointer; int n=1<<18; public SegTree(int n_, long[] a_, long[] b_) { f=new long[2*n-1][2]; l_pointer=new int[2*n-1]; r_pointer=new int[2*n-1]; for (int i=0;i=0;--i) { f[i]=merge(f[l_pointer[i]], f[r_pointer[i]]); } } long[] merge(long[] fl, long[] fr) { return new long[] {fl[0]*fr[0]%mod, (fr[0]*fl[1]+fr[1])%mod}; } long[] query(int l, int r, int L, int R, int k) { if (r <= L || R <= l) return new long[] {1, 0}; if (L <= l && r <= R) return f[k]; long[] vl=query(l, (l+r)/2, L, R, l_pointer[k]); long[] vr=query((l+r)/2, r, L, R, r_pointer[k]); return merge(vl, vr); } // 0-indexed // 下から bit 目 void swap(int bit) { bit=17-bit; for (int i=0;i<(1<=0;--i) { f[i]=merge(f[l_pointer[i]], f[r_pointer[i]]); } } long eval(int L, int R, long x) { long[] ab=query(0, n, L, R, 0); return (ab[0]*x+ab[1])%mod; } } public void solve() { FastScanner sc=new FastScanner(); PrintWriter pw=new PrintWriter(System.out); int N=sc.nextInt(); int Q=sc.nextInt(); long[] A=new long[N]; long[] B=new long[N]; for (int i=0;i list=new ArrayList<>(); for (int i=0;i>shift)%2==1) { tree.swap(shift); mask^=1<