#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>
#include <queue>
#include <regex>
#include <cassert>
#include <map>
// #include "bits/stdc++.h"

using namespace std;
//debug

#define rep(i, N, M) for (ll i = N; i < M; ++i)
#define rrep(i, N, M) for (ll i = N; i < M; --i)
#define pb push_back


typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef priority_queue<ll> pqll;
typedef priority_queue<pll, vector<pll>> pqpll;
typedef priority_queue<ll, vll, greater<ll>> pqll_greater;
typedef priority_queue<pll, vector<pll>, greater<pll>> pqpll_greater;


#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define vec(a) vector<a>
#define _CRT_SECURE_NO_WARNINGS

template<class T, class S>
T atbit(T n, S i) {
	return (n >> i) % i;
}

template<class T>
T getbit(T i) {
	return 1LL << i;
}

//#define TRANSFORM(v,w,func) decltype(v) w ; transform((v).begin(),(v).end(),back_inserter(w),func);

using namespace std;

ll euclidean_gcd(ll a, ll b) {
	if (a < b) euclidean_gcd(b, a);
	ll r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}


int main() {
	ll H,W;
	cin >> H>>W;
	vb a(H*W);
	rep(i, 0, H) {
		rep(j, 0, W)
		{	
			ll x;
			cin>> x;
			if (i% 2 == 0) {
				a[i*W+j] = (x % 2 == 0);

			}
			else {
				a[i*W + W-j-1] = (x % 2 == 0);

			}

		}
	}
	vector<pair<pll, pll>> res;

	pair<bool, bool> state{ 0,0 };
	bool isGoodState = a[0];
	rep(i, 1, H*W) {
		if ( a[i]) {
			if (isGoodState) {

			}
			else {
				ll row = i / W;

				if (row % 2 == 0) {
					if (i%W != 0) {
						res.push_back({ { i / W,i%W - 1 }, { i / W,i%W } });
					}
					else {//corner
						res.push_back({ { i / W-1,i%W  },{ i / W,i%W } });
					}

				}
				else {
					if (i%W != 0) {
						res.push_back({ { i / W,W- i%W  },{ i / W, W- i%W -1} });

					}
					else {
						res.push_back({ { i / W - 1,W-1 },{ i /W,W-1 } });
					}

				}
			
			}
		}
		else  {
			if (isGoodState) {
				isGoodState = false;
				
			}
			else {
				isGoodState = true;
				ll row = i / W;

				if (row % 2 == 0) {
					if (i%W != 0) {
						res.push_back({ { i / W,i%W - 1 },{ i / W,i%W } });
					}
					else {//corner
						res.push_back({ { i / W - 1,i%W },{ i / W,i%W } });
					}

				}
				else {
					if (i%W != 0) {
						res.push_back({ { i / W,W - i % W },{ i / W, W - i % W - 1 } });

					}
					else {
						res.push_back({ { i / W - 1,W - 1 },{ i / W,W - 1 } });
					}

				}

			}
		}
	}



	//rep(i, 0, H) {
	//	if (i % 2 == 0) {
	//		rep(j, 1, W) {
	//			if ()break;
	//			if (a[i][j]) {
	//				res.push_back({ {i,j - 1},{i,j} });

	//			}
	//			else {
	//				res.push_back({ { i,j - 1 },{ i,j } });
	//				isGoodState = true;
	//			}
	//		}
	//	}
	//}


		cout << res.size() << endl;
	rep(i, 0, res.size()) {
		cout << res[i].first.first+1 <<" "<< res[i].first.second +1<<" "<< res[i].second.first+1 <<" "<< res[i].second.second+1 << endl;
	}

}
//ll N;
//cin >> N;
//vll a(N);
//rep(i,0, N) cin >> a[i];

Measured memory_bytes: 6388