// #pragma GCC optimize ("O3")

#include <bits/stdc++.h>
using namespace std;

#define sd(mark) scanf("%d",&mark)
#define s2d(mark,marx) scanf("%d%d",&mark,&marx)
#define s3d(mark,marx,marz) scanf("%d%d%d",&mark,&marx,&marz)
#define sf(mark) scanf("%f",&mark)
#define slf(mark) scanf("%lf",&mark)
#define sst(mark) scanf("%s",&mark)
#define sld(mark) scanf("%lld",&mark)
#define s2ld(mark,marx) scanf("%lld%lld",&mark,&marx)
#define s3ld(mark,marx,marz) scanf("%lld%lld%lld",&mark,&marx,&marz)
#define sline(mline) scanf("%[^\n]%*c",&mline)

#define pi(n) printf("%d\n",n)
#define pf(n) printf("%f\n",n)
#define plf(n) printf("%lf\n",n)
#define pst(n) printf("%s\n",n)
#define pl(n) printf("%lld\n",n)

#define pis(n) printf("%d ",n)
#define pfs(n) printf("%f ",n)
#define plfs(n) printf("%lf ",n)
#define pss(n) printf("%s ",n)
#define pls(n) printf("%lld ",n)

#define sff fflush(stdout)
#define decimal(n) cout.precision(n)
#define fix cout<<fixed
#define debug(mark) printf("check%d\n",mark)
#define in(a) cin>>a
#define out(a) cout<<a<<'\n'
#define clr(mark) memset(mark,0,sizeof(mark))
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ll long long int
#define mod 1000000007ll
#define llu unsigned long long int
#define endl '\n'
#define INF 1123456789
#define eps 1e-9
#define fo(i,a,b) for(int i=a;i<b;++i)
#define foll(i,a,b) for(ll i=a;i<b;++i)
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define UL 100000		//5
#define MAXN 1000000	//6
#define MAXL 10000000	//7

typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< pair<ll,ll> > vll;
typedef pair<char,char> pcc;
typedef vector< pair<int, int> > vii;


// bool mark[MAXN+5];

// int sieve()
// {
// 	int ULL = MAXN;
// 	for(int i=0;i<=ULL;i++) mark[i]=true;
// 	for(int i=2;i*i<=ULL;i++) if(mark[i]) for(int j=i*i;j<=ULL;j+=i) mark[j]=false;
// 	for(int i=2;i<=ULL;i++) if(mark[i]) p.pb(i);
// 	return p.size();
// }


ll gcd(ll a, ll b) {if(!b) return a; return gcd(b,a%b);}

ll modexp(ll a,ll b)
{
	if(b==0) return 1;
	if(b==1) return a;
	ll temp = modexp(a,(b>>1));
	temp = (temp*temp);
	return (temp*modexp(a,b&1));
}

ll modexp(ll a,ll b, ll m)
{
	if(b==0) return 1;
	if(b==1) return a%m;
	ll temp = modexp(a,(b>>1),m);
	temp = (temp*temp)%m;
	return (temp*modexp(a,b&1,m))%m;
}

ll modinv(ll a, ll p)
{
	return modexp(a,p-2,p);
}

// int A[3*UL+5],B[3*UL+5];
// ll sA[3*UL+5],sB[3*UL+5];

// int solve(int l1,int l2,int r1,int r2)
// {
// 	if(l1>r1||l2>r2) return 0;
// 	int x = l1, y = l2;
// 	while((sA[x]-sA[l1-1])!=(sB[y]-sB[l2-1]))
// 	{
// 		if((sA[x]-sA[l1-1])<(sB[y]-sB[l2-1])) x++;
// 		else if((sA[x]-sA[l1-1])>(sB[y]-sB[l2-1])) y++;
// 	}
// 	return (1+solve(x+1,y+1,r1,r2));
// }

int A[505][505];
bool odd[505][505];
int posr[505];
int sumr[505];
int main()
{
	int n,m; s2d(n,m);
	int x,S=0,row=-1;
	fo(i,1,n+1) fo(j,1,m+1) {sd(x); A[i][j] = x; S+=x; if(x&1){odd[i][j]=true;} else odd[i][j] = false;}
	fo(i,1,n+1) posr[i] = -1;
	fo(i,1,n+1)
	{
		for(int j = m;j>0;j--)
		{
			if(A[i][j]!=0) {posr[i] = j; break;}
		}
	}
	fo(i,1,n+1) sumr[i] = 0;
	fo(i,1,n+1) fo(j,1,m+1) sumr[i] += A[i][j];
	fo(i,1,n+1) if(sumr[i]!=0) {row = i; break;}
	if(row==-1){cout<<"0\n";}
	else
	{
		vector< pair <pii, pii > > ans;
		fo(i,row,n+1)
		{
			if(sumr[i])
			{
				for(int j = posr[i];j > 1; j--)
					if(A[i][j]&1) {ans.pb(mp(mp(i,j),mp(i,j-1))); A[i][j-1]++;}
			}
		}
		fo(i,row,n)
		{
			if(A[i][1]&1) {ans.pb(mp(mp(i,1),mp(i+1,1))); A[i+1][1]++;}
		}
		cout<<(int)(ans.size())<<'\n';
		fo(i,0,ans.size())
		{
			cout<<ans[i].ff.ff<<" "<<ans[i].ff.ss<<" "<<ans[i].ss.ff<<" "<<ans[i].ss.ss<<'\n';
		}
	}
}

Measured memory_bytes: 5360