mod = 998244353 R = 3 Rinv = 332748118 W = [pow(R, (mod-1)>>i, mod) for i in range(24)] Winv = [pow(Rinv, (mod-1)>>i, mod) for i in range(24)] def fft(k, f): for l in range(k, 0, -1): d = 1<=k>=0 else 0 q2=[] l=1<<(len(bin(K+1))-2) q3=[0]*l for j in range(K+1): q3[j]=fb[j] q2+=[FPSlog(q3)] g=[0]*(K+1) for i in range(1,K+1): if K%i==0: c=[0]*(K+1) for v in a: c[v//(K//i)]+=1 l=1<<(len(bin(i+1))-2) q=[0]*l for j in range(1,i+1): if c[j]>0: for k in range(l): if k