H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
for i in range(H):
    for j in range(W):
        A[i][j] = A[i][j]%2
flag=0
for i in range(H):
    if i%2==0:
        for j in range(W):
            if A[i][j]==1:
                cur = (i,j)
                flag=1
                break
        if flag==1:break
    else:
        for j in range(W-1,-1,-1):
            if A[i][j]==1:
                cur = (i,j)
                flag = 1
                break
        if flag==1:break
B = []
if flag==0:
    N=0
else:
    i,j = cur
    ind = 1
    while i<H:
        if i%2==0:
            while True:
                if j==W-1:
                    if ind==1:
                        B.append([(i,j),(i+1,j)])
                    i += 1
                    if A[i][j]==1:
                        ind = 1-ind
                    break
                else:
                    if ind==1:
                        B.append([(i,j),(i,j+1)])
                    j += 1
                    if A[i][j]==1:
                        ind = 1-ind
        else:
            while j>=0:
                if j==0:
                    if ind==1:
                        B.append([(i,j),(i+1,j)])
                    i += 1
                    break
                else:
                    if ind==1:
                        B.append([(i,j),(i,j-1)])
                    j -= 1
                    if A[i][j]==0:continue
                    else:
                        ind = 1-ind
    N = len(B)
print(N)
for i in range(N):
    (i1,j1),(i2,j2)=B[i]
    print(i1+1,j1+1,i2+1,j2+1)

### FIXED CODE ###

from collections import deque
H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
B = [[0 if A[i][j]%2==0 else 1 for j in range(W)] for i in range(H)]
C = [deque([]) for _ in range(H)]
for i in range(H):
    for j in range(W):
        if B[i][j]==1:
            C[i].append(j)
cnt = 0
for i in range(H):
    cnt += sum(B[i])
if cnt%2==1:
    for i in range(H-1,-1,-1):
        if len(C[i])>0:
            C[i].pop()
            break
D = []
flag = 0
i = 0
while i<H:
    while len(C[i])>=2:
        if flag==0:
            j1 = C[i].popleft()
            i1 = i
            j2 = C[i].popleft()
            i = i
            for j in range(j1,j2):
                D.append((i,j,i,j+1))
        else:
            j1 = C[i].pop()
            i1 = i
            j2 = C[i].pop()
            i2 = i
            for j in range(j1,j2,-1):
                D.append((i,j,i,j-1))
    if len(C[i])==0:
        i += 1
    else:
        j = i+1
        while j<H:
            if len(C[j])>0:
                break
        j1 = C[i].pop()
        i1 = i
        if flag==0:
            j2 = C[j].pop()
            i2 = j
            for l in range(j1,W-1):
                D.append((i1,l,i1,l+1))
            for k in range(i1,i2):
                D.append((k,W-1,k+1,W-1))
            for l in range(W-1,j2,-1):
                D.append((i2,l,i2,l-1))
        else:
            j2 = C[j].popleft()
            i2 = j
            for l in range(j1,0,-1):
                D.append((i1,l,i1,l-1))
            for k in range(i1,i2):
                D.append((k,0,k+1,0))
            for l in range(j2):
                D.append((i2,l,i2,l+1))
        flag = 1-flag
        i = j
print(len(D))
for d in D:
    print(d[0]+1,d[1]+1,d[2]+1,d[3]+1)