
data class Move(val y: Int, val x: Int, var ny: Int, var nx: Int)

fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map { it.toInt() }
    val table = listOf<MutableList<Int>>().toMutableList()
    (1..H).forEach {
        table.add(readLine()!!.split(" ").map { it.toInt() }.toMutableList())
    }

    var reverse = false
    var move : Move? = null
    table.forEachIndexed { y, row ->
        val range = if (reverse) {
            row.size - 1 downTo 0
        } else {
            0..(row.size - 1)
        }

        for (x in range) {
            if (move != null) {
                move!!.ny = y
                move!!.nx = x
                operate(table, move!!)
                move = null
            }

            val value = row.get(x)
            val isOdd = value.mod(2) == 1
            if (isOdd) {
                move = Move(y, x, -1, -1)
            } else {
                move = null
            }
        }

        println(" ")
        reverse = !reverse
    }

    printResult()
}

val movements = listOf<Move>().toMutableList()
fun operate(table: MutableList<MutableList<Int>>, move: Move) {
    val pointVal = table.get(move.y).get(move.x)
    table.get(move.y).set(move.x, pointVal - 1)
    val newPointVal = table.get(move.ny).get(move.nx)
    table.get(move.ny).set(move.nx, newPointVal + 1)
    movements.add(move)
}

fun printResult() {
    println(movements.size)
    movements.forEach {
        println("${it.y + 1} ${it.x + 1} ${it.ny + 1} ${it.nx + 1}")
    }
}
