import java.io.PrintWriter; import java.util.Scanner; public class Main { static final int MOD = 998244353; static final long NTTg = 3; static long powm(long a, long i) { if(i == 0) return 1; long r = powm(a*a%MOD,i/2); if(i%2 == 1) r=r*a%MOD; return r; } static final long invNTTg = powm(NTTg, MOD-2); static void NTT(long[] A, long g) { int N = A.length; for(int i=0, j=0; j>1; k>(i^=k); k>>=1); } for(int i=1; i= MOD) A[k] -= MOD; A[k+i] = l+MOD-r; if(A[k+i] >= MOD) A[k+i] -= MOD; } qj = qj * q % MOD; } } } int N; long Q[]; int E[][]; int cdep[]; int cp[]; int cbfs[]; void centroid_decomposition() { cdep = new int[N]; cp = new int[N]; for(int i=0; i=1; i--) Z[P[I[i]]] += Z[I[i]]; int cdP[] = new int[N]; Iidx = 0; cdP[Iidx] = -1; I[Iidx++] = 0; for(int i=0; i Z[s]) nx = e; if(nx == -1) break; Z[s] -= Z[nx]; Z[nx] += Z[s]; s = nx; } cbfs[i] = s; Z[s] = 0; if(par != -1) { cdep[s] = cdep[par]+1; cp[s] = par; } for(int e : E[s]) if(Z[e] != 0) { cdP[Iidx] = s; I[Iidx++] = e; } } } long k0; int max_ntt_size_log; int max_ntt_size; long inv_mod[]; long C[]; long nttC[][]; void input() { Scanner sc = new Scanner(System.in); N = sc.nextInt(); Q = new long[N]; for(int i=0; i dep_s) { long[] sigma_nx = sigma_tree(nx, dep_s + 1); for(int i=0; i