#include <bits/stdc++.h>

#define REP(i, n) for(decltype(n) i = 0; i < n; i++)

#define ALL(c)   c.begin(), c.end()
#define SORT(c)  std::sort(ALL(c))
#define RSORT(c) std::sort(ALL(c), std::greater<decltype(c)::value_type>())

using namespace std;
using ll = long long;

const int MOD  = (int)1e9 + 7;
const int INF  = (int)1e9 + 1;
const ll  LINF = (ll)1e18 + 1;

class Pt {
public:
    int x;
    int y;

    constexpr Pt() : x(0), y(0) { }
    constexpr Pt(const int& _x, const int& _y) : x(_x), y(_y) { }

    constexpr Pt(const Pt &obj) : x(obj.x), y(obj.y) { }
    Pt &operator=(const Pt &obj) { x = obj.x; y = obj.y; return *this; }

    std::vector<Pt> getAroundFourPts() const {
        std::vector<Pt> result;
        for(int hwi = -1; hwi <= 1; hwi++) {
            for(int wwi = -1; wwi <= 1; wwi++) {
                if((hwi == 0) ^ (wwi == 0)) {
                    result.emplace_back(x + wwi, y + hwi);
                }
            }
        }
        return result;
    }

    std::vector<Pt> getAroundPts() const {
        std::vector<Pt> result;
        for(int hwi = -1; hwi <= 1; hwi++) {
            for(int wwi = -1; wwi <= 1; wwi++) {
                if(hwi != 0 || wwi != 0) {
                    result.emplace_back(x + wwi, y + hwi);
                }
            }
        }
        return result;
    }

    constexpr bool isWithinRange(const int& w, const int& h) const {
        return 0 <= x && x < w && 0 <= y && y < h;
    }

    constexpr Pt operator +() const {
        return *this;
    }

    constexpr Pt operator -() const {
        return{ -x, -y };
    }

    constexpr Pt operator +(const Pt& other) const {
        return{ x + other.x, y + other.y };
    }

    constexpr Pt operator +=(const Pt& other) {
        x += other.x;  y += other.y;  return *this;
    }

    constexpr Pt operator -(const Pt& other) const {
        return{ x - other.x, y - other.y };
    }

    constexpr Pt operator -=(const Pt& other) {
        x -= other.x;  y -= other.y;  return *this;
    }

    constexpr Pt operator *(int s) const {
        return{ x * s, y * s };
    }

    constexpr Pt operator *=(const Pt& other) {
        x *= other.x;  y *= other.y;  return *this;
    }

    constexpr Pt operator /(int s) const {
        return{ x / s, y / s };
    }

    constexpr Pt operator /=(const Pt& other) {
        x /= other.x;  y /= other.y;  return *this;
    }

    constexpr bool operator ==(const Pt& other) {
        return x == other.x && y == other.y;
    }

    constexpr bool operator !=(const Pt& other) {
        return !(x == other.x && y == other.y);
    }

    friend std::ostream& operator <<(std::ostream& os, const Pt& obj) {
        os << "x : " << obj.x << ", "
           << "y : " << obj.y << std::endl;
        return os;
    }
};

template <typename T>
class MyMat {
public:
    using EleMap = std::map<T, std::vector<Pt>>;

    T* data;
    uint w, h;

    MyMat(const uint& _w, const uint& _h, const T& def_val = 0) :
        w(_w), h(_h) {
        data = new T[h * w]();
        if(def_val != 0) {
            for(uint i = 0; i < w * h; i++) {
                data[i] = def_val;
            }
        }
    }

    MyMat(const uint &_w, const uint &_h, const T*& _data) :
        w(_w), h(_h), data(_data) {}

    ~MyMat() { delete[] data; }

    MyMat(const MyMat &obj) : data(obj.data), w(obj.w), h(obj,h) {}
    MyMat &operator=(const MyMat &obj) { data = obj.data; w = obj.w; h = obj,h; return *this; }

    MyMat clone() {
        T* new_data = new T[h * w];
        for(int i = 0; i < h * w; i++) {
            new_data[i] = data[i];
        }

        return MyMat<T>(w, h, new_data);
    }

    void stdRead() {
        for(uint hi = 0; hi < h; hi++) {
            for(uint wi = 0; wi < w; wi++) {
                std::cin >> data[wi + hi * w];
            }
        }
    }

    template<class... A>
    EleMap searchElements(const A&... keys) const {
        auto key_list = std::initializer_list<T>{keys...};

        EleMap result;
        for(const auto& key : key_list) {
            result.insert(std::make_pair(key, std::vector<Pt>()));
        }

        for(uint hi = 0; hi < h; hi++) {
            for(uint wi = 0; wi < w; wi++) {
                for(const auto& key : key_list) {
                    if(data[wi + hi * w] == key) {
                        result[key].push_back(Pt(wi, hi));
                    }
                }
            }
        }
    }

    T& at(const uint& wi, const uint& hi) const {
        return data[wi + hi * w];
    }

    T& at(const Pt& pt) const {
        return data[pt.x + pt.y * w];
    }

    friend std::ostream& operator <<(std::ostream& os, const MyMat<T>& obj) {
        for(uint hi = 0; hi < obj.h; hi++) {
            for (uint wi = 0; wi < obj.w; wi++) {
                os << obj.data[wi + hi * obj.w] << " ";
            }
            os << std::endl;
        }
        return os;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int H, W;
    std::cin >> H >> W;

    MyMat<int> mat(W, H);
    mat.stdRead();

    vector<pair<Pt, Pt>> ans;
    auto move = [&](const Pt& src, const Pt& dst) -> void {
                    mat.at(src) -= 1;
                    mat.at(dst) += 1;
                    ans.emplace_back(src, dst);
                };

    REP(hi, H) {
        REP(wi, W) {
            Pt src(wi, hi);
            if(mat.at(src) == 0) continue;

            if(hi != 0 && mat.at(wi, hi - 1) % 2 == 1) {
                move(src, Pt(wi, hi - 1));
            }
            else if(wi != 0 && mat.at(wi - 1, hi) % 2 == 1) {
                move(src, Pt(wi - 1, hi));
            }
            else if(mat.at(src) % 2 == 1) {
                if(wi != W - 1) {
                    move(src, Pt(wi + 1, hi));
                }
                else if(hi != H - 1) {
                    move(src, Pt(wi, hi + 1));
                }
            }
        }
    }

    std::cout << ans.size() << std::endl;
    for(const auto& v : ans) {
        std::cout << v.first.y  + 1 << " "
                  << v.first.x  + 1 << " "
                  << v.second.y + 1 << " "
                  << v.second.x + 1 << std::endl;
    }

    return 0;
}


Measured memory_bytes: 5232