#define MD 998244353 ll@K,N=0,l=0;Mint a=1,f;rep(K){ll@L,@M;N+=L*M;f=1;rep(i,L)f*=i+1;a/=f**M;f=1;rep(j,M)f*=j+1;a/=f;}rep(i,N)a*=i+1;wt(a);