const input = require("fs").readFileSync("/dev/stdin", "utf8").split(/\s+/).filter(x=>x.length);
var h = +input.shift();
var w = +input.shift();
var a = [...Array(h)].map(() => Array(w));
input.forEach((x, i) => a[i / w | 0][i % w] = +x);
var i = 0, j = 0, ip, jp;
var result = "";
var N = 0;
while (true) {
    ip = i;
    jp = j;
    if (i % 2) {
        if (--j == -1) {
            j++;
            i++;
        }
    } else {
        if (++j == w) {
            j--;
            i++;
        }
    }
    if (i >= h) break;
    if (a[ip][jp] % 2) {
        a[ip][jp]--;
        a[i][j]++;
        result += "\n" + (ip+1) + " " + (jp+1) + " " + (i+1) + " " + (j+1);
        N++;
    }
}
console.log(N + result);