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

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readM(T)(size_t r,size_t c,ref T[][]t){t=new T[][](r);foreach(ref v;t)readA(c,v);}

void main()
{
  int h, w; readV(h, w);
  int[][] a; readM(h, w, a);

  struct M { int x1, y1, x2, y2; }
  M[] m;

  auto sgn(int x) { return x < 0 ? -1 : x > 0 ? 1 : 0; }

  auto move(int x1, int y1, int x2, int y2, int z)
  {
    auto x = x1;
    while (x != x2) {
      m ~= M(x, y1, x+sgn(x2-x1), y1).repeat(z).array;
      x += sgn(x2-x1);
    }
    auto y = y1;
    while (y != y2) {
      m ~= M(x2, y, x2, y+sgn(y2-y1)).repeat(z).array;
      y += sgn(y2-y1);
    }
    a[x1][y1] -= z;
    a[x2][y2] += z;
  }

  foreach (i; 0..h)
    foreach (j; 0..w)
      if (i != 0 || j != 0)
        move(i, j, 0, 0, a[i][j]);

 loop: foreach (i; 0..h)
    foreach (j; 0..w)
      if (i != 0 || j != 0) {
        if (a[0][0] == 2) break loop;
        move(0, 0, i, j, 1);
        if (a[0][0] == 2) break loop;
        move(0, 0, i, j, 1);
      }

  writeln(m.length);
  foreach (mi; m)
    writefln("%d %d %d %d", mi.x1, mi.y1, mi.x2, mi.y2);
}
