Baby Ming likes to deal with pixel map in the following way:
First, converting the pixel map into binary image (recorded as 01), and then, in the binary figures, for each grid, add up the grid and its neighboring grids’ binary number, and store in matrix <b>$Mat$</b>.
All the pictures Baby Ming chosen have a <b>blank upper margin and bottom margin</b> (the value of which is 0 in the binary image), because he thinks such a picture is beautiful.
The matrix $Mat$ is so big that Baby Ming is worried about the mistakes in the matrix. So he wants to know whether the binary image can be regained according to the $Mat$.