#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define DEKAI 1000000007
/* ┗(^o^)┛ｗｗｗｗｗ┏(^o^)┓ﾄﾞｺﾄﾞｺﾄﾞｺﾄﾞｺｗｗｗｗｗ */

int a[1000][1000];
int main(){
	int h,w;
	cin>>h>>w;
	lp(i,h){
		lp(j,w){
			cin>>a[i][j];
		}
	}
	vector<vector<int>> ans;
	int st=a[0][0];
	int yoko[1000];
	lp(i,1000) yoko[i]=0;
	int memox=-1,memoy=-1;
	lp(i,h){
		memox=-1;
		memoy=-1;
		lp(j,w){
			if(a[i][j]%2==1){
				if(memox==-1){
					memox=i;
					memoy=j;
				}
				else{
					vector<int> memo;
					int ii=i;
					int jj=j;
					swap(memox,ii);
					swap(memoy,jj);
					while(ii!=memox){
						if(ii>memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii-1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii--;
						}
						if(ii<memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii+1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii++;
						}
					}
					while(jj!=memoy){
						if(jj>memoy){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii);
							memo.push_back(jj-1);
							ans.push_back(memo);
							jj--;
						}
						if(jj<memoy){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii);
							memo.push_back(jj+1);
							ans.push_back(memo);
							jj++;
						}
					}
					memox=-1;
				}
			}	
			if(j==w-1){
				if(memox==-1&&a[i][j]%2==0) continue;
				else yoko[i]=1;
				if(memox==-1&&a[i][j]%2==1) yoko[i]=0;
				if(memox==-1){
				}
				else{
					vector<int> memo;
					int ii=i;
					int jj=j;
					swap(memoy,jj);
					swap(memox,ii);
					while(ii!=memox){
						if(ii>memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii-1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii--;
						}
						if(ii<memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii+1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii++;
						}
					}
					while(jj!=memoy){
						if(jj>memoy){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii);
							memo.push_back(jj-1);
							ans.push_back(memo);
							jj--;
						}
						if(jj<memoy){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii);
							memo.push_back(jj+1);
							ans.push_back(memo);
							jj++;
						}
					}
					memox=-1;
				}
			}
		}
	}
	memox=-1;
	lp(i,h){
	if(yoko[i]==1){
				if(memox==-1){
					memox=i;
				}
				else{
					int j=w-1;
					memoy=w-1;
					vector<int> memo;
					int ii=i;
					int jj=j;
					swap(memoy,jj);
					swap(memox,ii);

					while(ii!=memox){
						if(ii>memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii-1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii--;
						}
						if(ii<memox){
							memo.clear();
							memo.push_back(ii);
							memo.push_back(jj);
							memo.push_back(ii+1);
							memo.push_back(jj);
							ans.push_back(memo);
							ii++;
						}
					}
					memox=-1;
				}
			}	

	}
	cout<<ans.size()<<endl;
	lp(i,ans.size()){
		vector<int> z=ans[i];
		cout<<z[0]+1<<" "<<z[1]+1<<" "<<z[2]+1<<" "<<z[3]+1<<endl;
	}
	/*lp(i,h){
		lp(j,w){
			cout<<a[i][j];
		}
		cout<<endl;
	}*/
	return 0;
}

Measured memory_bytes: 12208