Introduction - If you have any usage issues, please Google them yourself
background
Have you ever played a game of mine? There is an operating system with this little game, the system is called what? In order to pass the game, it is necessary to find all the mines in a NxM area. In the course of the game, the computer will display a number of numbers on the map to help you determine where there is a mine. For example, in the following map of the 4x4 with two mines (* said mine):
*...
....
.*..
....
According to the map above, can be calculated should be provided to the player s number is shown as follows:
*100
Two thousand two hundred and ten
1*10
One thousand one hundred and ten
Each figure indicates that there are several mines around the box, of course, there is only one square around the time there will be eight.
input
The input will consist of a series of maps, each map of the first line contains two integers n and m (0 <n, m 100), they said the map of the number of rows and columns. Each of the following N lines with M characters, incl