#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
typedef long long ll;

int a[510][510];
bool b[510][510];
int main()
{
    int h, w;
    cin >> h >> w;
    int dx[4] = {1, 0, -1,0};
    int dy[4] = {0, 1, 0, -1};

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> a[i][j];
        }
    }
    int cnt = 0;
    vector<pair<int, int>> p, q;
    for (int i = 0; i < h; i++)
    {   
        for (int j = 0; j < w; j++)
        {
            bool flag=true;
            b[i][j] = true;
            if (a[i][j] % 2 == 1)
            {
                flag = false;
                for (int k = 0; k < 4; k++)
                {

                    if (a[i + dx[k]][j + dy[k]] % 2 == 1 && 0 <= i + dx[k] && i + dx[k] < h && 0 <= j + dy[k] && j + dy[k] < w && flag == false && b[i + dx[k]][j + dy[k]]==false)
                    {
                        cnt++;
                        a[i + dx[k]][j + dy[k]]++;
                        a[i][j]--;
                        p.push_back(make_pair(i + 1, j + 1));
                        q.push_back(make_pair(i + dx[k] + 1, j + dy[k] + 1));
                        flag = true;
                        break;
                    }
                }
            }
                if(!flag){
                    for (int k = 0; k < 4; k++)
                    {
                        if (0 <= i + dx[k] && i + dx[k] < h && 0 <= j + dy[k] && j + dy[k] < w && b[i + dx[k]][j + dy[k]]==false)
                        {
                            cnt++;
                            a[i + dx[k]][j + dy[k]]++;
                            a[i][j]--;
                            p.push_back(make_pair(i + 1, j + 1));
                            q.push_back(make_pair(i + dx[k] + 1, j + dy[k] + 1));
                            break;
                        }
                    }
                    
                }

            }
        }
        
    
    cout << cnt << endl;
    for (int i = 0; i < p.size(); i++)
    {
        cout << p[i].first << " " << p[i].second << " " << q[i].first << " " << q[i].second << endl;
    }

    return 0;
}

Measured memory_bytes: 5484