#include #define int long long #define poly basic_string using namespace std; const int N=65,M=1e5+5,Mod=998244353,INV2=499122177; int n,p1,p2,p3,p4,p5,pw2[N],pw3[N],g,invg; struct node{ int x,y; }w2,w3,ans,a[M],b[M],c[M]; poly P[N][N],Q[N][N],R[N][N],S[N],T[N],F[N],G[N],H[N],W0[N],W1[N],now={{1,0}}; node operator+(node a,node b) { a.x=(a.x+b.x)%Mod,a.y=(a.y+b.y)%Mod; return a; } node operator-(node a,node b) { a.x=(a.x-b.x+Mod)%Mod,a.y=(a.y-b.y+Mod)%Mod; return a; } void operator-=(node &a,node b) { a.x=(a.x-b.x+Mod)%Mod,a.y=(a.y-b.y+Mod)%Mod; } void operator+=(node &a,node b) { a.x=(a.x+b.x)%Mod,a.y=(a.y+b.y)%Mod; } node operator*(node a,node b) { return {(a.x*b.x-3*a.y*b.y%Mod+3*Mod)%Mod,(a.x*b.y+a.y*b.x)%Mod}; } node operator*(node a,int b) { return {a.x*b%Mod,a.y*b%Mod}; } int ksm(int x,int y) { int ret=1,bace=x; while(y) { if(y&1)ret=ret*bace%Mod; bace=bace*bace%Mod; y>>=1; } return ret; } node ksm(node x,int y) { node ret={1,0},bace=x; while(y) { if(y&1)ret=ret*bace; bace=bace*bace; y>>=1; } return ret; } node inv(node a) { int val=ksm((a.x*a.x+3*a.y*a.y)%Mod,Mod-2); return {a.x*val%Mod,Mod-a.y*val%Mod}; } node operator/(node a,node b) { return a*inv(b); } namespace NTT { node A[M],B[M]; int tr[M]; int init(int n) { int ret=1; while(ret>1]>>1)|((i&1)?(ret>>1):0); return ret; } void ntt(node *f,int n,int op) { for(int i=0;i