fun main(args: Array<String>) {
    val mod = 1000000007
    val (H,W) = readIntList()

    var tmpX = 0
    var tmpY = 0
    var hasCoin = false
    val ansList = mutableListOf<String>()

    for (h in 1..H) {
        var line = readIntList().withIndex()
        if (h % 2 == 0)
            line = line.reversed()

        for ((i, c) in line) {
            val w = i+1
            var coin = c

            if (hasCoin) {
                ansList.add("$tmpY $tmpX $h $w")
                coin++
                hasCoin = false
            }

            if (coin%2 == 1) {
                hasCoin = true
                tmpX = w
                tmpY = h
            }
        }
    }

    println(ansList.size)
    println(ansList.joinToString("\n"))
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)