Sum

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

Given a rectangular array aa of size n×mn \times m and a prime number pp, find two rectangular arrays, bb of size K×nK \times n and cc of size K×mK \times m, such that:

  1. 0b_i,j<p0\le b\_{i,j} < p (1iK,1jn\forall 1 \le i \le K, 1 \le j \le n);
  2. 0c_i,j<p0\le c\_{i,j} < p (1iK,1jm\forall 1 \le i \le K, 1 \le j \le m);
  3. _j=1nb_i,j1\sum\_{j=1}^n b\_{i,j} \ge 1 (1iK\forall 1 \le i \le K);
  4. _i=1mc_i,j1\sum\_{i=1}^m c\_{i,j} \ge 1 (1jK\forall 1 \le j \le K);
  5. _l=1Kb_l,ic_l,ja_i,j(modp)\sum\_{l=1}^K b\_{l,i} \cdot c\_{l,j} \equiv a\_{i,j} \pmod{p} (1in,1jm\forall 1 \le i \le n, 1 \le j \le m).

입력

The first line of input contains four positive integers nn, mm, KK, pp (1nm,Kn,Km1051 \le n \cdot m, K \cdot n, K \cdot m \le 10^5; 2p109+72 \le p \le 10^9 + 7; pp is prime).

The ii-th of the following nn lines contains mm integers a_i,1,a_i,2,,a_i,ma\_{i,1}, a\_{i,2}, \ldots, a\_{i,m} (0a_i,j<p0 \le a\_{i,j} < p).

출력

If there is no solution, output a line "No solution!".

Otherwise, output KK lines, ii-th of which contains n+mn + m integers b_i,1,b_i,2,,b_i,n,c_i,1,c_i,2,,c_i,mb\_{i,1}, b\_{i,2}, \ldots, b\_{i,n}, c\_{i,1}, c\_{i,2}, \ldots, c\_{i,m}.

If there are several possible answers, print any one of them.