单点时限: 1.0 sec
内存限制: 256 MB
Now, little w is playing the game Mine-sweeper. The game is working on a $n \times m$ grid field and each cell contains 0 or 1 mine.
For each cell, little w only know the total number of mines in itself and its 8 adjacent cells. He wants to know the total number of mines in this field, please help him.
The first line contains two positive integers $n$ and $m$. $(1 \leq n, m \leq 200)$
In the following $n$ lines, each line contains $m$ integers. And each number represents the information little w knows of a cell, the total number of mines in itself and its 8 adjacent cells.
One line with one integer represents the total number of mines.
3 4 2 3 2 1 2 3 2 1 1 2 2 1
3
4 5 1 1 3 3 3 1 2 5 5 4 0 1 4 5 4 0 1 3 4 3
8
For example, suppose the number of mine in a field likes
011
010
000
Then little w will know
233
233
111