#abc109d. [abc109_d]Make Them Even

[abc109_d]Make Them Even

Problem Statement

There is a grid of square cells with HH horizontal rows and WW vertical columns. The cell at the ii-th row and the jj-th column will be denoted as Cell (i,j)(i, j).

In Cell (i,j)(i, j), aija_{ij} coins are placed.

You can perform the following operation any number of times:

Operation: Choose a cell that was not chosen before and contains one or more coins, then move one of those coins to a vertically or horizontally adjacent cell.

Maximize the number of cells containing an even number of coins.

Constraints

  • All values in input are integers.
  • 1leqH,Wleq5001 \\leq H, W \\leq 500
  • 0leqaijleq90 \\leq a_{ij} \\leq 9

Input

Input is given from Standard Input in the following format:

HH WW a11a_{11} a12a_{12} ...... a1Wa_{1W} a21a_{21} a22a_{22} ...... a2Wa_{2W} :: aH1a_{H1} aH2a_{H2} ...... aHWa_{HW}

Output

Print a sequence of operations that maximizes the number of cells containing an even number of coins, in the following format:

NN y1y_1 x1x_1 y1y_1' x1x_1' y2y_2 x2x_2 y2y_2' x2x_2' :: yNy_N xNx_N yNy_N' xNx_N'

That is, in the first line, print an integer NN between 00 and HtimesWH \\times W (inclusive), representing the number of operations.

In the (i+1)(i+1)-th line (1leqileqN1 \\leq i \\leq N), print four integers yi,xi,yiy_i, x_i, y_i' and xix_i' (1leqyi,yileqH1 \\leq y_i, y_i' \\leq H and 1leqxi,xileqW1 \\leq x_i, x_i' \\leq W), representing the ii-th operation. These four integers represents the operation of moving one of the coins placed in Cell (yi,xi)(y_i, x_i) to a vertically or horizontally adjacent cell, (yi,xi)(y_i', x_i').

Note that if the specified operation violates the specification in the problem statement or the output format is invalid, it will result in Wrong Answer.


Sample Input 1

2 3
1 2 3
0 1 1

Sample Output 1

3
2 2 2 3
1 1 1 2
1 3 1 2

Every cell contains an even number of coins after the following sequence of operations:

  • Move the coin in Cell (2,2)(2, 2) to Cell (2,3)(2, 3).
  • Move the coin in Cell (1,1)(1, 1) to Cell (1,2)(1, 2).
  • Move one of the coins in Cell (1,3)(1, 3) to Cell (1,2)(1, 2).

Sample Input 2

3 2
1 0
2 1
1 0

Sample Output 2

3
1 1 1 2
1 2 2 2
3 1 3 2

Sample Input 3

1 5
9 9 9 9 9

Sample Output 3

2
1 1 1 2
1 3 1 4