time limit per test: 0.25 sec. memory limit per test: 65536 KB
input: standard output: standard
"Oh, no!" --- Petya said, walking around his recently bought ground plot. Petya wants to build a new house on it. According to Petya's building project the house should look from above like "C" character. There are many trees growing on Petya's plot. But everyone who cuts down a tree in Petya's country is sent to cut down trees for the rest of his life. So first of all Petya has to choose a place for building the house without cutting any tree. He is feeling that he is not able to find the solution on his own, so he decided to ask you to help him. The task is simplified a little by the fact that Petya's plot has a rectangular shape of size N*M, divided into 1*1 square cells. For each cell it is known whether there are any trees growing there. House can't occupy cells where trees grow. Fortunately Petya could explain how his house must look from above. 1) House must consist of three rectangular blocks. 2) Area of each block must be greater than zero. 3) These blocks must touch each other, but can't overlap. 4) Left-top cells of all blocks must be on one vertical. 5) The width of the middle block must be less than the width of upper and lower blocks. Petya wants to build a house with maximal possible area.
The first line of input contains integers N and M (1<=N,M<=180) separated by whitespace. Each of the following N lines contains M integer numbers separated by whitespaces. Each number is either 0 or 1; 1 means that there are trees in the cell, 0 means that the cell is empty.
On the first line output maximal possible area. After that output N lines that describe your plan in the same format as in the input. If the cell is occupied by the house, write 8 instead of 0. If it is impossible to solve problem, output "-1" (without quotes).