{"raw_statement":[{"iden":"problem statement","content":"We have an $H \\times W$ grid, where each square has one integer written on it. For $1\\leq i\\leq H$ and $1\\leq j\\leq W$, let $A_{i,j}$ denote the integer written on the square at the $i$\\-th row and $j$\\-th column.\nYou can do the operation below any number of times (possibly zero).\n\n*   Choose integers $i$ and $j$ such that $1\\leq i\\leq H - 1$ and $1\\leq j\\leq W - 1$.\n*   Choose another integer $x$.\n*   Add $x$ to each of $A_{i,j}$, $A_{i,j+1}$, $A_{i+1,j}$, and $A_{i+1,j+1}$.\n\nPrint the minimum possible value of $\\sum_{i=1}^H \\sum_{j=1}^W |A_{i,j}|$ after your operations, and the integers on the grid when that value is achieved."},{"iden":"constraints","content":"*   $2\\leq H, W \\leq 500$\n*   $|A_{i,j}|\\leq 10^9$"},{"iden":"input","content":"Input is given from Standard Input from the following format:\n\n$H$ $W$\n$A_{1,1}$ $\\ldots$ $A_{1,W}$\n$\\vdots$\n$A_{H,1}$ $\\ldots$ $A_{H,W}$"},{"iden":"sample input 1","content":"2 3\n1 2 3\n4 5 6"},{"iden":"sample output 1","content":"9\n0 -3 -1\n3 0 2\n\nHere is a sequence of operations that produces the grid in the Sample Output.\n\n*   Do the operation with $(i, j, x) = (1, 1, -1)$.\n*   Do the operation with $(i, j, x) = (1, 2, -4)$.\n\nHere, we have $\\sum_{i=1}^H \\sum_{j=1}^W |A_{i,j}| = 0 + 3 + 1 + 3 + 0 + 2 = 9$."},{"iden":"sample input 2","content":"2 2\n1000000000 -1000000000\n-1000000000 1000000000"},{"iden":"sample output 2","content":"4000000000\n2000000000 0\n0 2000000000\n\nIt is fine if $|A_{i,j}| > 10^9$ after your operations."},{"iden":"sample input 3","content":"3 4\n0 2 0 -2\n-3 -1 2 0\n-3 -3 2 2"},{"iden":"sample output 3","content":"0\n0 0 0 0\n0 0 0 0\n0 0 0 0"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}