import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto tmp = readln.split.to!(int[]);
    auto H = tmp[0], W = tmp[1];
    alias Coord = Tuple!(int, int);
    alias Record = Tuple!(Coord, Coord);
    Record[] rec;
    int inc;
    Coord before;
    foreach (y; 0..H) {
        auto as = readln.split.to!(int[]);
        auto proc = (int x) {
            if (inc > 0) {
                as[x] += inc;
                rec ~= Record(before, Coord(y+1,x+1));
                inc = 0;
            }
            if (as[x] > 0 && as[x] % 2 == 1) {
                as[x]--;
                inc = 1;
                before = Coord(y+1,x+1);
            }
        };
        if (y % 2 == 0) {
            foreach(x; 0..W) proc(x);
        } else {
            foreach_reverse(x; 0..W) proc(x);
        }
    }
    writeln(rec.length);
    foreach (r; rec) {
        writefln("%d %d %d %d", r[0].expand, r[1].expand);
    }
}

