#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#define ll long long
//#define local

using namespace std;

const int MOD = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 505;

int a[maxn][maxn];
int h, w;
int main() {
#ifdef local
    if(freopen("/Users/Andrew/Desktop/data.txt", "r", stdin) == NULL) printf("can't open this file!\n");
#endif
    scanf("%d%d", &h, &w);
    int cnt_odd = 0;
    ll d = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            scanf("%d", &a[i][j]);
            if (a[i][j] % 2 == 1)
                cnt_odd++;
        }
    }
    if (cnt_odd%2 == 1) cnt_odd--;
    cnt_odd /= 2;
    int inv = 0;
    for (int i = 0; i < h; ++i) {
        if (i%2 == 0) {
            if (cnt_odd == 0) break;
            for (int j = 0; j < w; ++j) {
                if (a[i][j]%2 == 0) {
                    if (inv) d++;
                }
                else {
                    if (inv == 0) {
                        inv = 1;
                    } else {
                        inv = 0;
                        d++;
                    }
                }
            }
        }
        else {
            if (cnt_odd == 0) break;
            for (int j = w-1; j >= 0; --j) {
                if (a[i][j]%2 == 0) {
                    if (inv) d++;
                }
                else {
                    if (inv == 0) {
                        inv = 1;
                    } else {
                        inv = 0;
                        d++;
                    }
                }
            }
        }
    }
    printf("%lld\n", d);
    inv = 0;
    for (int i = 0; i < h; ++i) {
        if (i%2 == 0) {
            for (int j = 0; j < w; ++j) {
                if (a[i][j]%2 == 0) {
                    if (inv == 1)  {
                        if (j != 0) printf("%d %d %d %d\n", i+1, j, i+1, j+1);
                        else printf("%d %d %d %d\n", i, j+1, i+1, j+1);
                    }
                }
                else {
                    if (inv == 0) {
                        inv = 1;
                    } else {
                        if (j != 0) printf("%d %d %d %d\n", i+1, j, i+1, j+1);
                        else printf("%d %d %d %d\n", i, j+1, i+1, j+1);
                        inv = 0;
                    }
                }
            }
        }
        else {
            for (int j = w-1; j >= 0; --j) {
                if (a[i][j]%2 == 0) {
                    if (inv == 1)  {
                        if (j != w-1) printf("%d %d %d %d\n", i+1, j+2, i+1, j+1);
                        else printf("%d %d %d %d\n", i, j+1, i+1, j+1);
                    }
                }
                else {
                    if (inv == 0) {
                        inv = 1;
                    } else {
                        if (j != w-1) printf("%d %d %d %d\n", i+1, j+2, i+1, j+1);
                        else printf("%d %d %d %d\n", i, j+1, i+1, j+1);
                        inv = 0;
                    }
                }
            }
        }
    }
#ifdef local
    fclose(stdin);
#endif
    return 0;
}











Measured memory_bytes: 3072