void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.array;

  int h, w; rd(h, w);
  auto a=new int[][](h, w);
  foreach(i; 0..h){
    a[i]=readln.split.to!(int[]);
  }

  int py=-1, px=-1;
  int[][] moves;
  foreach(i; 0..h){
    foreach(j; 0..w){
      if(a[i][j]&1){
        if(py>=0 && px>=0){
          for(int y=py+1; y<=i; y++){
            moves~=[y-1, j, y, j];
          }
          if(px!=j){
            const sign=j-px>0 ? 1 : -1;
            for(int x=px; x!=j; x+=sign){
              moves~=[i, x, i, x+sign];
            }
          }
          // a[py][px]=a[i][j]=0;
          py=px=-1;
        }else{
          py=i; px=j;
        }
      }
    }
  }
  writeln(moves.length);
  foreach(move; moves) writefln("%(%s %)", move.map!(e=>e+1).array);
  // writeln(a);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}
