{"problem":{"name":"Bombs","description":{"content":"We have a board with $R$ rows running horizontally and $C$ columns running vertically. Let $(i,j)$ denote the square at the $i$\\-th row from the top and $j$\\-th column from the left. You are given cha","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc295_b"},"statements":[{"statement_type":"Markdown","content":"We have a board with $R$ rows running horizontally and $C$ columns running vertically. Let $(i,j)$ denote the square at the $i$\\-th row from the top and $j$\\-th column from the left.\nYou are given characters $B_{i,j}$ representing the current states of $(i,j)$. `.` represents an empty square; `#` represents a square with a wall; `1`, `2`,$\\dots$, `9` represent a square with a bomb of power $1,2,\\dots,9$, respectively.\nAt the next moment, all bombs will explode **simultaneously**. When a bomb explodes, every square whose Manhattan distance from the square with the bomb is not greater than the power of the bomb will turn into an empty square. Here, the Manhattan distance from $(r_1,c_1)$ to $(r_2,c_2)$ is $|r_1-r_2|+|c_1-c_2|$.\nPrint the board after the explosions.\n\n## Constraints\n\n*   $1\\leq R,C \\leq 20$\n*   $R$ and $C$ are integers.\n*   Each $B_{i,j}$ is one of `.`, `#`, `1`, `2`, $\\dots$, `9`.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$R$ $C$\n$B_{1,1}B_{1,2}\\dots B_{1,C}$\n$\\vdots$\n$B_{R,1}B_{R,2}\\dots B_{R,C}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc295_b","tags":[],"sample_group":[["4 4\n.1.#\n###.\n.#2.\n#.##","...#\n#...\n....\n#...\n\n![image](https://img.atcoder.jp/abc295/4816cc7b706b4a095bb9a5d07c614790.jpg)\n\n*   The explosion of the bomb at $(1,2)$ will turn the blue squares and purple squares in the above figure into empty squares.\n*   The explosion of the bomb at $(3,3)$ will turn the red squares and purple squares in the above figure into empty squares.\n\nAs seen in this sample, the explosion ranges of bombs may overlap."],["2 5\n..#.#\n###.#","..#.#\n###.#\n\nThere may be no bombs."],["2 3\n11#\n###","...\n..#"],["4 6\n#.#3#.\n###.#.\n##.###\n#1..#.","......\n#.....\n#....#\n....#."]],"created_at":"2026-03-03 11:01:14"}}