### BUGGY CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w = MAP()
a = [[0]*(w+2)]
b = []
for i in range(1, h+1):
    a.append([0] + LIST() + [0])
    for j in range(1, w+1):
        if a[i][j] % 2 == 1:
            b.append([i,j])
a += [0]*(w+2)
que = deque(b)
ans = []
d = [[1]*(w+2) for i in range(h+2)]
for i in range(1, h+1):
    for j in range(1, w+1):
        d[i][j] = 0
while que:
    s = que.popleft()
    d[s[0]][s[1]] = 1
    tmp = s[:]
    try:
        g = que.popleft()
    except:
        break
    while s[0] != g[0]:
        if s[0] < g[0]:
            if d[s[0]+1][s[1]] == 0:
                s[0] += 1
            elif d[s[0]][s[1]+1] == 0:
                s[1] += 1
            elif d[s[0]][s[1]-1] == 0:
                s[1] -= 1
        else:
            if d[s[0]+1][s[1]] == 0:
                s[0] -= 1
            elif d[s[0]][s[1]+1] == 0:
                s[1] += 1
            elif d[s[0]][s[1]-1] == 0:
                s[1] -= 1
        ans.append(tmp+s)
        d[s[0]][s[1]] = 1
        tmp = s[:]        
    while s[1] != g[1]:
        if s[1] < g[1]:
            if d[s[0]][s[1]+1] == 0:
                s[1] += 1
            elif d[s[0]+1][s[1]] == 0:
                s[0] += 1
            elif d[s[0]-1][s[1]] == 0:
                s[0] -= 1
        else:
            if d[s[0]][s[1]-1] == 0:
                s[1] -= 1
            elif d[s[0]+1][s[1]] == 0:
                s[0] += 1
            elif d[s[0]-1][s[1]] == 0:
                s[0] -= 1
        ans.append(tmp+s)
        d[s[0]][s[1]] = 1
        tmp = s[:]
print(len(ans))
for x in ans:
    print(*x)

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w = MAP()
a = [[0]*(w+1)]
for i in range(1, h+1):
    a.append([0] + LIST())
ans = []
flag = False
for i in range(1, h+1):
    if i % 2 == 1:
        for j in range(1, w+1):
            if a[i][j] % 2 == 1:
                flag = not flag
            if flag:
                if j < w:
                    ans.append([i,j,i,j+1])
                elif i < h:
                    ans.append([i,j,i+1,j])
    else:
        for j in range(w, 0, -1):
            if a[i][j] % 2 == 1:
                flag = not flag
            if flag:
                if j > 1:
                    ans.append([i,j,i,j-1])
                elif i < h:
                    ans.append([i,j,i+1,j])

print(len(ans))
for x in ans:
    print(*x)