Олимпиадный тренинг

Задача 38259. Minesweeper with hints


During spring break, Olya thought about her behavior for a long time and decided to study more in the fourth quarter. But already the first biology lesson in the new quarter destroyed all Olya's good intentions. Olya is bored, just unbearably bored. Having nothing to do, she started playing the famous Minesweeper game on her phone.

Just in case, let's recall what this game is about. The game takes place on a field measuring N × M cells, some of which are "mined". The goal of the game is to open all the cells that do not contain mines.

The player opens the cells, trying not to open the cell with a mine. Opening a cage with a mine, he loses. If there is no mine under the open cell, then a number appears in it, showing how many cells adjacent to the newly opened one are “mined”. Cells are considered neighbors if they have a common side or a common vertex. Cells that the player considers "mined" can be marked with a flag to avoid accidentally opening them.

Olya plays the Minesweeper version with built-in hints. One of the prompts, "Show Errors", works like this. If there are more flags in the neighborhood of a cell in which a certain number is written than can be adjacent to this cell (that is, more flags than the number written in the cell), all the flags around this cell are highlighted in yellow. This hint cannot find other errors, otherwise it would not be interesting to play at all.

Your task — according to the current state of the playing field, determine which flags will be highlighted in yellow after the hint is launched.

Input
The first line contains two numbers N and M separated by spaces — height and width of the table respectively (1 ≤ N ≤ 15, 1 ≤ M ≤ 15). The next N lines contain M characters each. These lines set the playing field. The following notation is used:

F — checkbox;

* — closed cage;

A number from 0 to 8 — open cell. The number itself indicates how many mines are in the cells adjacent to this one.

Imprint
In the first line print the number of checkboxes that will be highlighted in yellow, and in the next N lines print for each such flag its coordinates — the row number and then the column number in which the checkbox is located. Flags can be displayed in any order.

If there are no highlighted flags, print a single number 0
 
Examples
# Input Output Explanations
1 2 3
FFF
*2*
3
1 2
1 3
1 1
In the test, in the cell with coordinates (2, 2) the number 2 is written, and it touches three flags, which is more than two. This means that all three of these checkboxes will be highlighted.