#P7572. 20

20

Description

For every 0i,j<40 \le i, j < 4, you are given x(i,j)x(i, j) such that:

  1. Commutativity: x(i,j)=x(j,i)x(i,j)=x(j,i).
  2. Associativity: x(x(i,j),k)=x(i,x(j,k))x(x(i,j),k)=x(i,x(j,k)).
  3. Identity element: x(0,i)=ix(0,i)=i.

Define a function f(n)f(n) such that:

  1. f(pk)=pkmod4f(p^k)=pk\bmod 4.
  2. When gcd(a,b)=1\gcd(a,b)=1, f(ab)=x(f(a),f(b))f(ab)=x(f(a),f(b)).

In particular, f(1)=0f(1)=0.

Define the function gg as:

g(n,k,r)=i=1nik[f(i)=r]g(n,k,r)=\sum_{i=1}^n i^k [f(i)=r]

Given mm and kk, for all 1im1 \le i \le \lfloor \sqrt m \rfloor, compute the values of $g\left(\left\lfloor \frac{m}{i} \right\rfloor, k, r\right)$ for all 0r<40 \le r < 4. Take all answers modulo 998244353998244353.

Input Format

The first line contains two integers mm and kk.
Then follow 44 lines, each with 44 integers. The jj-th integer on the ii-th line is x(i1,j1)x(i-1,j-1).

Output Format

Output m\lfloor \sqrt m \rfloor lines.
The ii-th line contains four non-negative integers. The rr-th integer is $g\left(\left\lfloor \frac{m}{i} \right\rfloor, k, r\right)$.

10 0
0 1 2 3
1 2 3 0
2 3 0 1
3 0 1 2
2 2 3 3
2 1 1 1
1 0 1 1
100 100
0 1 2 3
1 0 3 2
2 3 0 1
3 2 1 0
457599333 476580683 403589597 762762658
361221912 612412943 661908092 483645330
242804711 682542199 535167020 465246643
913280460 516845083 917292729 390364642
39265044 919790719 181416471 421087779
530140662 31014314 181416471 226287885
982924733 31014314 851084249 226287885
982924733 938693280 851084249 226287885
982924733 938693280 851084249 435036575
982924733 938693280 851084249 138976409

Hint

This problem does not use bundled tests, and the testdata has a slight difficulty gradient.

For 16%16\% of the testdata, m106m \le 10^6.

For 100%100\% of the testdata, 1m10101 \le m \le 10^{10}, 0k10000 \le k \le 1000.

Translated by ChatGPT 5