#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
typedef long long ll;
const int mod = 998244353;
const int maxsize = 270111;
const int proot = 3;
ll qpow(ll x, ll y) {
ll ret = 1;
while(y) {
if(y&1) ret = ret * x % mod;
x = x * x % mod;
y >>= 1;
}
return ret;
}
struct ntt {
int n, M, w_pre[maxsize], inv[maxsize];
ntt() {
M = 1;
while(M*2<maxsize) M <<= 1;
int w = qpow(proot, (mod - 1) / M);
w_pre[0] = 1;
for(int i=1; i<=M; i++) w_pre[i] = 1ll * w_pre[i-1] * w % mod;
inv[1] = 1;
for(int i=2; i<maxsize; i++) inv[i] = mod - 1ll * inv[mod % i] * (mod / i) % mod;
}
void FFTinit(int sz) {
n = 1;
while(n < sz) n <<= 1;
assert(n <= M);
}
void FFT(int a[], int coef) {
typedef unsigned long long ull;
const ull mod2 = 1ull * mod * mod;
static ull na[maxsize];
for(int i=0, j=0; i<n; i++) {
na[j] = a[i] < 0 ? (a[i] + mod) : a[i];
for(int l=n>>1; (j^=l) < l; l>>=1) continue;
}
static int w[maxsize];
for(int l=1; l<n; l<<=1) {
int l2 = l + l, u = M / l2;
if(coef == 1) {
for(int j=0, t=0; j<l; j++, t+=u) w[j] = w_pre[t];
}
else {
for(int j=0, t=M; j<l; j++, t-=u) w[j] = w_pre[t];
}
for(int i=0; i<n; i+=l2) {
for(int j=0; j<l; j++) {
ull tmp = na[i+j+l] % mod * w[j];
na[i+j+l] = na[i+j] - tmp + mod2;
na[i+j] += tmp;
}
}
if(l == (1 << 8) || l == (1 << 16)) for(int i=0; i<n; i++) na[i] %= mod;
}
for(int i=0; i<n; i++) a[i] = 1ll * na[i] * mod * (coef == -1?inv[n]:1) % mod;
}
vector<int> multi(vector<int> &A, vector<int> &B, int N = -1) {
if(N == -1) N = max(0, int(A.size() + B.size()) - 1);
FFTinit(A.size() + B.size());
static int a[maxsize], b[maxsize];
for(int i=0; i<n; i++) a[i] = i < A.size() ? A[i] % mod : 0;
for(int i=0; i<n; i++) b[i] = i < B.size() ? B[i] % mod : 0;
FFT(a, 1);
FFT(b, 1);
for(int i=0; i<n; i++) a[i] = 1ll * a[i] * b[i] % mod;
FFT(a, -1);
vector<int> ret(N);
for(int i=0; i<N; i++) ret[i] = a[i];
return ret;
}
} M1;
const int maxn = 100111;
int n, a[maxn];
typedef long long ll;
const int maxsize = 270111;
ll qpow (ll x, ll k, ll mod){return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1, mod)*(k&1?x:1)%mod;}
//NTT head - START
template <const int mod, const int proot> struct ntt {
int n, M, w_pre[maxsize], inv[maxsize];
ntt() {
M = 1; while (M*2<maxsize) M <<= 1;
int w = qpow(proot, (mod-1)/M, mod);
w_pre[0] = 1;
for (int i=1; i<=M; i++) w_pre[i] = 1ll*w_pre[i-1]*w%mod;
inv[1] = 1;
for (int i=2; i<maxsize; i++) inv[i] = mod-1ll*inv[mod%i]*(mod/i)%mod;
}
void FFTinit(int sz) {
n = 1; while (n<sz) n <<= 1;
assert(n<=M);
}
void FFT(int a[], int coef) {
typedef unsigned long long ull;
const ull mod2=1ull*mod*mod;
static ull na[maxsize];
for (int i=0, j=0; i<n; i++) {
na[j] = a[i]<0? a[i]+mod: a[i];
for (int l=n>>1; (j^=l)<l; l>>=1) continue;
}
static int w[maxsize];
for (int l=1; l<n; l<<=1) {
int l2=l+l, u=M/l2;
if (coef==1) {
for (int j=0, t=0; j<l; j++, t+=u) w[j] = w_pre[t];
} else {
for (int j=0, t=M; j<l; j++, t-=u) w[j] = w_pre[t];
}
for (int i=0; i<n; i+=l2) {
for (int j=0; j<l; j++) {
ull tmp = na[i+j+l]%mod*w[j];
na[i+j+l] = na[i+j]-tmp+mod2;
na[i+j] += tmp;
}
}
if(l==(1<<8)||l==(1<<16)) for (int i=0; i<n; i++) na[i] %= mod;
}
for (int i=0; i<n; i++) a[i] = 1ll*na[i]%mod*(coef==-1?inv[n]:1)%mod;
}
vector<int> multi(vector<int> &A, vector<int> &B, int N=-1) {
if (N==-1) N = max(0, int(A.size()+B.size())-1);
FFTinit(A.size()+B.size());
static int a[maxsize], b[maxsize];
for (int i=0; i<n; i++) a[i] = i<A.size()? A[i]%mod: 0;
for (int i=0; i<n; i++) b[i] = i<B.size()? B[i]%mod: 0;
FFT(a,1), FFT(b,1);
for (int i=0; i<n; i++) a[i] = 1ll*a[i]*b[i]%mod;
FFT(a,-1);
vector<int> ret(N);
for (int i=0; i<N; i++) ret[i] = a[i];
return ret;
}
};
ntt <998244353, 3> MS;
ntt <1004535809, 3> MS2;
ntt <2013265921, 31> MS3;
vector<int> calc(int l, int r) {
if(l == r) {
vector<int> ret;
ret.push_back(0);
ret.push_back(a[l]);
return ret;
}
int mid = (l + r) / 2;
vector<int> lv = calc(l, mid);
vector<int> rv = calc(mid+1, r);
return M1.multi(lv, rv);
}
int fac[maxn], invf[maxn];
void solve() {
scanf("%d", &n);
for(int i=1; i<=n; i++) scanf("%d", a+i);
vector<int> m = calc(1, n);
int ans = 0;
for(int i=0; i<=n; i++) {
ans = (ans + 1ll * fac[i] * m[i]) % mod;
}
ans = 1ll * ans * invf[n] % mod;
printf("%d\n", ans);
}
int main() {
fac[0] = 1;
for(int i=1; i<maxn; i++) fac[i] = 1ll * i * fac[i-1] % mod;
invf[maxn-1] = qpow(fac[maxn-1], mod - 2);
for(int i=maxn-1; i>=1; i--) invf[i-1] = 1ll * i * invf[i] % mod;
int tc;
scanf("%d", &tc);
while(tc--) solve();
return 0;
}