# 题目分析

$$f(n)=\sum_{i=0}^{n-1} A(i)g(n-1-i)C_{n-1}^i + B(n-1)$$

$$g(n)=\sum_{i=1}^n f(i)g(n-i)C_{n-1}^{i-1}$$

$$\frac{f(n)}{(n-1)!}=\sum_{i=0}^{n-1} \frac{g(n-1-i)}{(n-1-i)!}\frac{A(i)}{i!}+\frac{B(n-1)}{n-1}$$

$$\frac{g(n)}{n!}=\frac{1}{n}(\sum_{i=1}^n \frac{f(i)}{(i-1)!}\frac{g(n-i)}{(n-i)!})$$

……个鬼啦！

# 代码

#include<bits/stdc++.h>
using namespace std;
#define RI register int
int q=0;char ch=' ';
while(ch<'0'||ch>'9') ch=getchar();
while(ch>='0'&&ch<='9') q=q*10+ch-'0',ch=getchar();
return q;
}
const int mod=998244353,N=262150;
int n,ma,mb,ans;
int fac[N],inv[N],ifac[N],A[N],B[N],f[N],g[N],rev[N];
int k1[N],k2[N],k3[N],k4[N];

int qm(int x) {return x>=mod?x-mod:x;}
int ksm(int x,int y) {
int re=1;
for(;y;y>>=1,x=1LL*x*x%mod) if(y&1) re=1LL*re*x%mod;
return re;
}
void NTT(int *a,int n,int x) {
for(RI i=0;i<n;++i) if(rev[i]>i) swap(a[i],a[rev[i]]);
for(RI i=1;i<n;i<<=1) {
int gn=ksm(3,(mod-1)/(i<<1));
for(RI j=0;j<n;j+=(i<<1)) {
int t1,t2,g=1;
for(RI k=0;k<i;++k,g=1LL*g*gn%mod) {
t1=a[j+k],t2=1LL*g*a[j+i+k]%mod;
a[j+k]=qm(t1+t2),a[j+i+k]=qm(t1-t2+mod);
}
}
}
if(x==1) return;
reverse(a+1,a+n);int invn=ksm(n,mod-2);
for(RI i=0;i<n;++i) a[i]=1LL*a[i]*invn%mod;
}

void prework() {
fac[0]=1;for(RI i=1;i<=n;++i) fac[i]=1LL*fac[i-1]*i%mod;
inv[0]=inv[1]=1,ifac[0]=1;
for(RI i=2;i<=n;++i) inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod;
for(RI i=1;i<=n;++i) ifac[i]=1LL*ifac[i-1]*inv[i]%mod;
}
void work(int l,int r) {
int mid=(l+r)>>1,n=r-l+1,kn=1,len=0;
while(kn<(n<<1)) kn<<=1,++len;
for(RI i=0;i<kn;++i) rev[i]=(rev[i>>1]>>1)|((i&1)<<(len-1));
{   for(RI i=0;i<kn;++i) k1[i]=k2[i]=0;
for(RI i=l;i<=mid;++i) k1[i-l]=g[i];
for(RI i=1;i<=n;++i) k2[i]=1LL*A[i]*ifac[i-1]%mod;
NTT(k1,kn,1),NTT(k2,kn,1);
for(RI i=0;i<kn;++i) k1[i]=1LL*k1[i]*k2[i]%mod;
NTT(k1,kn,-1);
for(RI i=mid+1;i<=r;++i) f[i]=qm(f[i]+k1[i-l]);
}
{   for(RI i=0;i<kn;++i) k1[i]=k2[i]=0;
for(RI i=l;i<=mid;++i) k1[i-l]=f[i];
for(RI i=0;i<=n;++i) k2[i]=g[i];
NTT(k1,kn,1),NTT(k2,kn,1);
for(RI i=0;i<kn;++i) k1[i]=1LL*k1[i]*k2[i]%mod;
NTT(k1,kn,-1);
for(RI i=mid+1;i<=r;++i) g[i]=qm(g[i]+k1[i-l]);
}
if(l>1) {
for(RI i=0;i<kn;++i) k1[i]=k2[i]=0;
for(RI i=l;i<=mid;++i) k1[i-l]=g[i];
for(RI i=0;i<=n;++i) k2[i]=f[i];
NTT(k1,kn,1),NTT(k2,kn,1);
for(RI i=0;i<kn;++i) k1[i]=1LL*k1[i]*k2[i]%mod;
NTT(k1,kn,-1);
for(RI i=mid+1;i<=r;++i) g[i]=qm(g[i]+k1[i-l]);
}
}
void cdq(int l,int r) {
if(l==r) {
f[l]=qm(f[l]+1LL*B[l-1]*ifac[l-1]%mod);
g[l]=1LL*qm(g[l]+f[l])*inv[l]%mod;
return;
}
int mid=(l+r)>>1;cdq(l,mid),work(l,r),cdq(mid+1,r);
}
int main()
{
prework();
B[0]=0,g[0]=1,cdq(1,n),ans=1LL*f[n]*fac[n-1]%mod;
if(n==1) ans=qm(ans+1);
printf("%d\n",ans);
return 0;
}