#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int h, w, a[1000][1000], a_[1000][1000];
    cin >> h >> w;
    REP(i, h)
    {
        REP(j, w)
        {
            cin >> a[i][j];

            a_[i][j] = a[i][j];
        }
    }

    int cnt = 0;

    REP(i, h)
    {
        REP(j, w)
        {

            if (i % 2 == 0) //->
            {
                if (a_[i][j] % 2 == 1)
                {
                    if (j == w - 1)
                    {
                        if (i != h - 1)
                        {

                            a_[i + 1][j]++;

                            cnt++;
                        }
                    }
                    else
                    {

                        a_[i][j + 1]++;

                        cnt++;
                    }
                }
            }
            else //<-
            {
                if (a_[i][w - j - 1] % 2 == 1)
                {
                    if (j == w - 1)
                    {
                        if (i != h - 1)
                        {

                            a_[i + 1][0]++;
                            cnt++;
                        }
                    }
                    else
                    {

                        a_[i][w - j - 2]++;
                        cnt++;
                    }
                }
            }
        }
    }

    cout << cnt << endl;

    REP(i, h)
    {
        REP(j, w)
        {

            if (i % 2 == 0) //->
            {
                if (a[i][j] % 2 == 1)
                {
                    if (j == w - 1)
                    {
                        if (i != h - 1)
                        {
                            cout << i + 1 << " " << j + 1 << " " << i + 1 + 1 << " " << j + 1 << endl;

                            a[i + 1][j]++;
                        }
                    }
                    else
                    {
                        cout << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 1 + 1 << endl;

                        a[i][j + 1]++;
                    }
                }
            }
            else //<-
            {
                if (a[i][w - j - 1] % 2 == 1)
                {
                    if (j == w - 1)
                    {
                        if (i != h - 1)
                        {
                            cout << i + 1 << " " << 0 + 1 << " " << i + 1 + 1 << " " << 0 + 1 << endl;

                            a[i + 1][0]++;
                        }
                    }
                    else
                    {
                        cout << i + 1 << " " << w - j - 1 + 1 << " " << i + 1 << " " << w - j - 2 + 1 << endl;

                        a[i][w - j - 2]++;
                    }
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 9856