#include #include using namespace std; using namespace atcoder; typedef modint998244353 mint; typedef long long ll; vector poly_inv(vector &a, int M = -314159265){ if (M == -314159265) M = (int)a.size(); else if (M <= 0) return {}; int n = a.size(); mint r = a[0].pow((ll)(mint::mod())-2); int m = 1; vector res = {r}; while (m < M){ vector f = a; f.resize(2 * m); vector g = res; g.resize(2 * m); internal::butterfly(f); internal::butterfly(g); for (int i=0; i<2*m; i++){ f[i] = f[i] * g[i]; } internal::butterfly_inv(f); for (int i=0; i multi_eval(vector x, vector a){ int n = x.size(); int siz = 1 << ceil_pow2(n); vector> g(2*siz, vector{1}); for (int i=0; i0; i--) g[i] = convolution(g[2*i], g[2*i+1]); vector f; for (int i=1; i<2*siz; i++){ if (i==1) f = a; else f = g[i>>1]; int fs = f.size(), gs = g[i].size(); int m = fs - gs + 1; vector v = {}, w = {}; if (m > 0){ vector ft(m); for (int j=0; j gt(gs); for (int j=0; j 1 && g[i][g[i].size() - 1] == 0){ g[i].pop_back(); } } vector ret(n); for (int i=0; i> ax >> n; mint a = ax; int m = pow(n, 0.5); vector f(m); for (int i=0; i g(m); for (int i=0; i h = multi_eval(g, f); for (int i=0; i> t; while(t--) solve(); }