{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e\u003ca href\u003d\"http://uva.onlinejudge.org/external/101/10189.pdf\"\u003e\u003cimg alt\u003d\"Download as PDF\" height\u003d\"26\" src\u003d\"http://uva.onlinejudge.org/components/com_onlinejudge/images/button_pdf.png\" title\u003d\"Download as PDF\" width\u003d\"100\"\u003e\u003c/a\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cdiv\u003e \n \u003cdiv\u003e\n Have you ever played Minesweeper? It’s a cute little game which comes within a certain Operating\n \u003c/div\u003e \n \u003cdiv\u003e\n System which name we can’t really remember. Well, the goal of the game is to find where are all the\n \u003c/div\u003e \n \u003cdiv\u003e\n mines within a M \u0002 N field. To help you, the game shows a number in a square which tells you how\n \u003c/div\u003e \n \u003cdiv\u003e\n many mines there are adjacent to that square. For instance, \n \u003cspan\u003e\u003cspan\u003esupose\u003c/span\u003e\u003c/span\u003e the following 4 \u0002 4 field with 2\n \u003c/div\u003e \n \u003cdiv\u003e\n mines (which are represented by an ‘*’ character):\n \u003c/div\u003e \n \u003cdiv\u003e\n *...\n \u003c/div\u003e \n \u003cdiv\u003e\n ....\n \u003c/div\u003e \n \u003cdiv\u003e\n .*..\n \u003c/div\u003e \n \u003cdiv\u003e\n ....\n \u003c/div\u003e \n \u003cdiv\u003e\n If we would represent the same field placing the hint numbers described above, we would end up\n \u003c/div\u003e \n \u003cdiv\u003e\n with:\n \u003c/div\u003e \n \u003cdiv\u003e\n *100\n \u003c/div\u003e \n \u003cdiv\u003e\n 2210\n \u003c/div\u003e \n \u003cdiv\u003e\n 1*10\n \u003c/div\u003e \n \u003cdiv\u003e\n 1110\n \u003c/div\u003e \n \u003cdiv\u003e\n As you may have already noticed, each square may have at most 8 adjacent squares\n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n The input will consist of an arbitrary number of fields. The first line of each field contains two integers\n\u003c/div\u003e \n\u003cdiv\u003e\n n and m (0 \u0026lt; n; m \u0014 100) which stands for the number of lines and columns of the field respectively.\n\u003c/div\u003e \n\u003cdiv\u003e\n The next n lines contains exactly m characters and represent the field.\n\u003c/div\u003e \n\u003cdiv\u003e\n Each safe square is represented by an ‘.’ character (without the quotes) and each mine square\n\u003c/div\u003e \n\u003cdiv\u003e\n is represented by an ‘*’ character (also without the quotes). The first field line where n \u003d m \u003d 0\n\u003c/div\u003e \n\u003cdiv\u003e\n represents the end of input and should not be processed.\n\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n For each field, you must print the following message in a line alone:\n\u003c/div\u003e \n\u003cdiv\u003e\n Field #x:\n\u003c/div\u003e \n\u003cdiv\u003e\n Where x stands for the number of the field (starting from 1). The next n lines should contain the\n\u003c/div\u003e \n\u003cdiv\u003e\n field with the ‘.’ characters replaced by the number of adjacent mines to that square. There must be\n\u003c/div\u003e \n\u003cdiv\u003e\n an empty line between field outputs.\n\u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv\u003e\n 4 4\n\u003c/div\u003e \n\u003cdiv\u003e\n *...\n\u003c/div\u003e \n\u003cdiv\u003e\n ....\n\u003c/div\u003e \n\u003cdiv\u003e\n .*..\n\u003c/div\u003e \n\u003cdiv\u003e\n ....\n\u003c/div\u003e \n\u003cdiv\u003e\n 3 5\n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cdiv\u003e\n **...\n \u003c/div\u003e \n \u003cdiv\u003e\n .....\n \u003c/div\u003e \n \u003cdiv\u003e\n .*...\n \u003c/div\u003e \n \u003cdiv\u003e\n 0 0\n \u003c/div\u003e \n \u003cdiv\u003e\n \u0026nbsp;\n \u003c/div\u003e \n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv\u003e\n Field #1:\n\u003c/div\u003e \n\u003cdiv\u003e\n *100\n\u003c/div\u003e \n\u003cdiv\u003e\n 2210\n\u003c/div\u003e \n\u003cdiv\u003e\n 1*10\n\u003c/div\u003e \n\u003cdiv\u003e\n 1110\n\u003c/div\u003e \n\u003cdiv\u003e\n \u0026nbsp;\n\u003c/div\u003e \n\u003cdiv\u003e\n Field #2:\n\u003c/div\u003e \n\u003cdiv\u003e\n **100\n\u003c/div\u003e \n\u003cdiv\u003e\n 33200\n\u003c/div\u003e \n\u003cdiv\u003e\n 1*100\n\u003c/div\u003e"}}]}