import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 1_000_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "x", long, "y");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long h, w;
    scan(h, w);
    auto table = new long[][](h, w);
    foreach (ref e; table)
        e = aryread();
    auto p = new Pair[](0);

    long cnt;
    foreach (i; iota(h))
    {
        foreach (j; iota(w))
        {
            if (i + 1 >= h && j + 1 >= w)
                break;

            if ((j / w) % 2)
            {
                // right to left
                if ((w - j - 2) > 0)
                {
                    table[i][(w - 1 - j)]--, table[i][(w - j - 2)]++;
                    p ~= [Pair(i + 1, w - j), Pair(i + 1, w - j - 1)];
                }
                else
                {
                    table[i][(w - 1 - j)]--, table[i + 1][(w - j - 1)]++;
                    p ~= [Pair(i + 1, w - j), Pair(i + 2, w - j)];
                }
                cnt++;
            }
            else
            {
                // left to right
                if (table[i][j] % 2)
                {
                    if (j + 1 < w)
                    {
                        table[i][j]--, table[i][j + 1]++;
                        p ~= [Pair(i + 1, j + 1), Pair(i + 1, j + 2)];
                    }
                    else
                    {
                        table[i][j]--, table[i + 1][j]++;
                        p ~= [Pair(i + 1, j + 1), Pair(i + 2, j + 1)];
                    }
                    cnt++;
                }
            }
        }
    }
    cnt.writeln();
    foreach (i; iota(cnt))
    {
        writefln("%s %s %s %s", p[2 * i].x, p[2 * i].y, p[2 * i + 1].x, p[2 * i + 1].y);
    }
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}
