#include <bits/stdc++.h>

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;
typedef pair<pii,pii> pc;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)


int f[500][500];
int h,w;
vector<pc> v;
ll cnt = 0;

void go(pc a){
  int ni = a.first.first+1;
  int nj = a.first.second+1;
  int gi = a.second.first+1;
  int gj = a.second.second+1;
  while(ni-gi!=0){
    if(ni-gi>0){
      cout << ni << " " << nj << " " << ni-1 << " " << nj <<endl;
      ni--;
    }else{
      cout << ni << " " << nj << " " << ni+1 << " " << nj <<endl;
      ni++;
    }
  }
  while(nj-gj!=0){
    if(nj-gj>0){
      cout << ni << " " << nj << " " << ni << " " << nj-1 <<endl;
      nj--;
    }else{
      cout << ni << " " << nj << " " << ni << " " << nj+1 <<endl;
      nj++;
    }
  }
}


int main(){
  cin >> h >> w;
  REP(i,h)REP(j,w) cin >> f[i][j];
  REP(i,h)REP(j,w){
    if(i==h-1&&j==w-1) break;
    if(f[i][j]%2){
      if(i<h-1){
        v.push_back(pc(pii(i,j),pii(i+1,j)));
        f[i+1][j]++;
      }else{
        v.push_back(pc(pii(i,j),pii(i,j+1)));
        f[i][j+1]++;
      }
      f[i][j]--;
    }
  }
  /*
  gi = 0;
  gj = 0;
  REP(i,h){
    REP(j,w){
      if(f[i][j]%2==0) continue;
      gi = i;
      gj = j+1;
      while(f[gi][gj]%2==0){
        gj++;
        if(gj>=w){
          gi++;
          gj=0;
        }
        if(gi>=h){
          j = w;
          i = h;
          break;
        }
        //cout << gi << " " <<gj <<endl;
      }
      if(i>=h || j >= w) break;
      v.push_back(pc(pii(i,j),pii(gi,gj)));
      cnt += abs(i-gi)+abs(j-gj);
      f[i][j]--;
      f[gi][gj]++;
      //cout << i << " " << j << " " << gi << " " << gj <<endl;
    }
  }
  */
  cout << v.size() << endl;
  REP(i,v.size()) go(v[i]);
}


/*
int f[500][500];
int h,w;

int ci,cj;
int gi,gj;
ll cnt = 0;
int now = 0;
vector<pc> v;

void go(pc a){
  int ni = a.first.first+1;
  int nj = a.first.second+1;
  int gi = a.second.first+1;
  int gj = a.second.second+1;
  while(ni-gi!=0){
    if(ni-gi>0){
      cout << ni << " " << nj << " " << ni-1 << " " << nj <<endl;
      ni--;
    }else{
      cout << ni << " " << nj << " " << ni+1 << " " << nj <<endl;
      ni++;
    }
  }
  while(nj-gj!=0){
    if(nj-gj>0){
      cout << ni << " " << nj << " " << ni << " " << nj-1 <<endl;
      nj--;
    }else{
      cout << ni << " " << nj << " " << ni << " " << nj+1 <<endl;
      nj++;
    }
  }
}

int main(){
  cin >> h >> w;
  REP(i,h)REP(j,w){
    cin >> f[i][j];
  }
  ci = cj = gi = gj = 0;
  while(true){
    while(true){
      if(f[ci][cj] == 2 || f[ci][cj] == 0 || (ci==gi && cj == gj)){
        break;
      }
      while(f[gi][gj] >=2){
        gj++;
        if(gj >= w){
          gi++;
          gj = 0;
        }
        if(gi >= h){
          ci = h;
          break;
        }
      }
      if(ci >= h) break;
      v.push_back(pc(pii(ci,cj),pii(gi,gj)));
      cnt += abs(ci-gi)+abs(cj-gj);
      f[ci][cj]--;
      f[gi][gj]++;
    }
    cj++;
    if(cj >= w){
      ci++;
      cj = 0;
    }
    if(ci >= h) break;
  }

  ci = cj = gi = gj = 0;
  while(true){
    while(true){
      if(f[ci][cj] % 2  == 0 || (ci==gi && cj == gj)){
        break;
      }
      while(f[gi][gj] % 2 == 0){
        gj++;
        if(gj >= w){
          gi++;
          gj = 0;
        }
        if(gi >= h){
          ci = h;
          break;
        }
      }
      if(ci >= h) break;
      cnt += abs(ci-gi)+abs(cj-gj);
      v.push_back(pc(pii(ci,cj),pii(gi,gj)));
      f[ci][cj]--;
      f[gi][gj]++;
    }
    cj++;
    if(cj >= w){
      ci++;
      cj = 0;
    }
    if(ci >= h) break;
  }
  cout << cnt << endl;
  REP(i,v.size()) go(v[i]);
}
*/


Measured memory_bytes: 5104