import java.io.IOException
import java.io.InputStream
import java.io.PrintWriter
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val out = PrintWriter(System.out)
    val h = sc.nextInt()
    val w = sc.nextInt()
    val a = Array(h) { sc.nextIntArray(w) }
    val ops = mutableListOf<Pair<Pair<Int, Int>, Pair<Int, Int>>>()

    for (y in 0 until h) {
        val (dx, range, lx) = if (y % 2 == 0) Triple(1, 0 until w - 1, w - 1) else Triple(-1, w - 1 downTo 1, 0)
        for (x in range) {
            if (a[y][x] % 2 == 1) {
                a[y][x]--
                a[y][x + dx]++
                ops.add(Pair(Pair(y + 1, x + 1), Pair(y + 1, x + dx + 1)))
            }
        }
        if (y < h - 1 && (a[y][lx] % 2 == 1)) {
            a[y][lx]--
            a[y + 1][lx]++
            ops.add(Pair(Pair(y + 1, lx + 1), Pair(y + 2, lx + 1)))
        }
    }

    out.println(ops.size)
    for (op in ops) {
        out.println("${op.first.first} ${op.first.second} ${op.second.first} ${op.second.second}")
    }
    out.close()
}

class Scanner(private val `in`: InputStream) {
    private val buffer = ByteArray(1024)
    private var ptr = 0
    private var buflen = 0

    private fun hasNextByte(): Boolean {
        if (ptr < buflen) return true
        else {
            ptr = 0
            try {
                buflen = `in`.read(buffer)
            } catch (e: IOException) {
                e.printStackTrace()
            }
            if (buflen <= 0) return false
        }
        return true
    }

    private fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else -1
    }

    private fun isPrintableChar(c: Char): Boolean {
        return c in '!'..'~'
    }

    private fun skipUnprintable() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr].toChar())) ptr++
    }

    fun hasNext(): Boolean {
        skipUnprintable()
        return hasNextByte()
    }

    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (isPrintableChar(b.toChar())) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun nextInt(): Int {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0
        var minus = false
        var b = readByte()
        if (b.toChar() == '-') {
            minus = true
            b = readByte()
        }
        if (b.toChar() !in '0'..'9') throw NumberFormatException()
        while (true) {
            if (b.toChar() in '0'..'9') {
                n *= 10
                n += b - '0'.toByte()
            } else return if (b.toInt() == -1 || !isPrintableChar(b.toChar())) {
                if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextIntArray(n: Int): IntArray {
        return IntArray(n) { nextInt() }
    }

    fun nextIntArrays(n: Int, m: Int): Array<IntArray> {
        val arrays = Array(m) { IntArray(n) }
        for (i in 0 until n) {
            for (j in 0 until m) {
                arrays[j][i] = nextInt()
            }
        }
        return arrays
    }

    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n: Long = 0
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b.toChar() !in '0'..'9') throw NumberFormatException()
        while (true) {
            if (b.toChar() in '0'..'9') {
                n *= 10
                n += (b - '0'.toByte()).toLong()
            } else return if (b.toInt() == -1 || !isPrintableChar(b.toChar())) {
                if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextLongArray(n: Int): LongArray {
        return LongArray(n) { nextLong() }
    }

    fun nextLongArrays(n: Int, m: Int): Array<LongArray> {
        val arrays = Array(m) { LongArray(n) }
        for (i in 0 until n) {
            for (j in 0 until m) {
                arrays[j][i] = nextLong()
            }
        }
        return arrays
    }
}


Measured memory_bytes: 78316