fun main(arr: Array<String>) {
    solve()
}

fun solve() {
    val (h,w) = readLine()!!.split(" ").map { it.toInt() }
    val map = (1..h).map { readLine()!!.split(" ").map { it.toInt() }.toMutableList() }
    val ans = mutableListOf<List<Int>>()
    for(i in (0 until h)) {
        val keyList = (if(i%2==0) (0 until w) else (0 until w).reversed()).toList()
        for(j in keyList) {
            if(map[i][j] % 2 == 0) {
                continue
            }
            var nextX = j
            var nextY = i
            if(j == keyList.last()) {
                nextY++
            } else {
                nextX = keyList[keyList.indexOf(j) + 1]
            }
            if(nextY >= h) {
                break
            }
            map[i][j]--
            map[nextY][nextX]++
            ans.add(listOf(i,j,nextY,nextX))
        }
    }
    println(ans.size)
    ans.forEach { println(it.map { it+1 }.joinToString(" ")) }
}