#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int h, w;
    cin >> h >> w;
    
    vector<vector<int>> board;
    vector<pair<int, int>> pos;
    repeat (i, h) {
        vector<int> empty;
        board.push_back(empty);
        repeat (j, w) {
            int t;
            cin >> t;
            if (t % 2 == 0) {
                board[i].push_back(0);
            }
            else {
                board[i].push_back(1);
            }
        }
    }
    
    repeat (i, h) {
        if (i % 2 == 0) {
            repeat_from_to (j, 0, w-1) {
                if (board[i][j] == 1) pos.push_back(make_pair(i, j));
            }
        }
        else {
            repeat_reverse_from_to (j, w-1, 0) {
                if (board[i][j] == 1) pos.push_back(make_pair(i, j));
            }
        }
    }
    
    /*
    for (auto e: pos) {
        cout << "(" << e.fst << "," << e.snd << ")" << endl;
    }
    */
    
    auto iseven = [](int i) -> bool {return (i % 2 == 0);};
    auto isodd  = [](int i) -> bool {return (i % 2 == 1);};
    
    auto f = [&](pair<int, int> p) -> pair<int, int> {
        int i = p.fst;
        int j = p.snd;
        if (i % 2 == 0) {
            if (i == h-1 and j == w-1) {
                return make_pair(-1, -1);
            }
        }
        else {
            if (i == h-1 and j == 0) {
                return make_pair(-1, -1);
            }
        }
            
        if (iseven(i) and j == w-1) {
            return make_pair(i+1, j);
        }
        if (iseven(i) and j < w-1) {
            return make_pair(i, j+1);
        }
        if (isodd(i) and j == 0) {
            return make_pair(i+1, j);
        }
        if (isodd(i) and j > 0) {
            return make_pair(i, j-1);
        }
        return make_pair(-2, -2);
    };
    
    /*
    auto show = [](pair<int, int> p) -> void {
        cout << "(" << p.fst << "," << p.snd << ") ";
    };
    
    
    repeat (i, h) {
        repeat (j, w) {
            show(f(make_pair(i, j)));
        }
        el;
    } el;
    */
    
    vector<pair<int, int>> ans;
    repeat (i, pos.size()/2) {
        auto startpos = pos[2*i];
        auto goalpos  = pos[2*i + 1];
        auto nextpos = startpos;
        do {
            ans.push_back(nextpos);
            nextpos = f(nextpos);
            ans.push_back(nextpos);
        } while (goalpos != nextpos);
    }
    
    cout << ans.size()/2 << endl;
    repeat (i, ans.size()/2) {
        cout << ans[i*2].fst+1 << " " << ans[i*2].snd+1 << " " << ans[i*2+1].fst+1 << " " <<ans[i*2+1].snd+1 << endl;
    }
}

Measured memory_bytes: 7156