Automatic Sprayer 2

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

문제

A farm is divided into n×nn \times n unit squares of nn rows and nn columns. Let's define (i,j)(i, j) as the unit square in the ii-th row and the jj-th column (1in1 \le i \le n, 1jn1 \le j \le n).

The distance between two squares (i_1,j_1)(i\_1, j\_1) and (i_2,j_2)(i\_2, j\_2) is defined to be d((i_1,j_1),(i_2,j_2))=i_1i_2+j_1j_2d\left(\left(i\_1, j\_1\right), \left(i\_2, j\_2\right)\right) = |i\_1 - i\_2| + |j\_1 - j\_2|, the Manhattan distance between those two squares.

There are automatic sprayers on this farm that spray fertilizer solution or herbicide so that the owner can produce grain efficiently.

Each sprayer lies entirely in a unit square. The sprayer in (x,y)(x,y) sprays A_x,yA\_{x,y} liters of solution to all unit squares. A_x,yA\_{x,y} can be any nonnegative integer.

The energy required for the sprayer in (x,y)(x, y) to spray solution to (i,j)(i, j) is exactly d((x,y),(i,j))×A_x,yd((x, y), (i, j)) \times A\_{x,y}. For each square (i,j)(i, j), we compute E_i,jE\_{i,j}, the sum of energies needed for all sprayers to spray the square (i,j)(i, j).

Given the matrix EE, write a program that generates any possible matrix AA that corresponds to matrix EE. EE will be given such that there exists such a matrix AA of nonnegative integers whose sum is at most 101210^{12}.

입력

The first line contains a single positive integer nn (2n1,0002 \le n \le 1\\,000).

The next nn lines each contain nn integers. The jj-th (1jn1 \le j \le n) integer in the ii-th (1in1 \le i \le n) line is E_i,jE\_{i,j} (0E_i,j1016)0 \le E\_{i,j} \le 10^{16})

The input is designed such that a matrix AA consisting of only non-negative integers whose sum is at most 101210^{12} exists which can yield EE.

출력

Output nn lines, each containing nn integers. The yy-th (1yn1 \le y \le n) integer in the xx-th (1xn1 \le x \le n) line should be A_x,yA\_{x,y}.