Once upon a time, a prison warden got lost in a forest during his adventure. Suddenly, a sphinx appeared in front of him, and said, "Lost human adventurer, proveth thy intellect by solving my riddle. Answer correctly, and I shall lead thee out this forest. Answer incorrectly, and I shall devour thee alive."
The sphinx's riddle was to adjust the "guiltiness values" of all the prisoners in the warden's prison to minimize the "chaoticness". It is known that:
The sphinx allows a series of operations to change the prisoners' guiltiness values. For each operation, the warden may choose any $$$2 \times 2$$$ submatrix of the prisoners, then apply one of the following to the four chosen prisoners:
Feared of being eaten alive, the warden asked you to write a program to solve the sphinx's riddle.
The first line contains an integer $$$n$$$ ($$$2 \le n \le 2000$$$). Then $$$n$$$ lines follow, each containing $$$n$$$ integers. The $$$n \times n$$$ matrix formed by these numbers describe the initial guiltiness values of all prisoners. All values are integers with absolute values not exceeding $$$10^{9}$$$.
Print the minimum possible chaoticness on the first line.
On the next $$$n$$$ lines, output a $$$n \times n$$$ matrix describing the guiltiness values of all prisoners after applying a series of some (possibly zero) operations. The rank of this matrix must correspond to the minimum chaoticness.
If there are multiple solutions to the riddle, output any one of them. Each value you output must have an absolute value of at most $$$10^{18}$$$ (it can be proven that this is always possible).
2 1 2 3 4
2 0 3 4 3
3 2 -1 -1 -2 -1 3 0 2 -2
0 0 0 0 0 0 0 0 0 0
| Name |
|---|


