#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;

#define INF INT_MAX
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define sz(a) int((a).size())
#define clr(a) memset(a,0,sizeof(a))
#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

template<class T> inline T gcd(T a,T b) //NOTE:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

/*bool sortby(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
    return (a.second < b.second);
}*/

const int MAX_N = 123456;

//int arr[MAX_N];
int A[511][511];

int main(){
    int H,W;
    scanf("%d%d",&H,&W);
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            scanf("%d",&A[i][j]);
        }
    }
    vector<pair<ii,ii> > V;
    int temp=0;
    bool flag=0;
    for(int i=1;i<H+1;i++){
        if(i%2){
            for(int j=1;j<W;j++){
                if(A[i][j]%2)
                    flag=1-flag;
                if(flag==1){
                    //printf("%d %d %d %d\n",i,j,i,j+1);
                    V.PB(MP(ii(i,j),ii(i,j+1)));
                }
            }
            if(A[i][W]%2)
                flag=1-flag;
            if(i+1<=H && flag==1){
                //printf("%d %d %d %d\n",i,W,i+1,W);
                V.PB(MP(ii(i,W),ii(i+1,W)));
            }
        }
        else{
            for(int j=W;j>1;j--){
                if(A[i][j]%2)
                    flag=1-flag;
                if(flag==1){
                    //printf("%d %d %d %d\n",i,j,i,j-1);
                    V.PB(MP(ii(i,j),ii(i,j-1)));
                }
            }
            /*trace2(i,W);
            DEBUG(A[i][W]);
            DEBUG(flag);*/
            if(A[i][1]%2)
                flag=1-flag;
            if(i+1<=H && flag==1){
                //printf("%d %d %d %d\n",i,1,i+1,1);
                //printf("Here\n");
                V.PB(MP(ii(i,1),ii(i+1,1)));
            }
        }
    }
    printf("%d\n",sz(V));
    for(int i=0;i<V.size();i++){
        printf("%d %d %d %d\n",V[i].F.F,V[i].F.S,V[i].S.F,V[i].S.S);
    }
    return 0;
}


Measured memory_bytes: 5232