local h, w = io.read("*n", "*n")

local function getindex(i_h, i_w)
  return i_w + (i_h - 1) * w
end

local map = {}
for i = 1, h * w do map[i] = 0 end
for i_h = 1, h do
  for i_w = 1, w do
    local idx = getindex(i_h, i_w)
    map[idx] = io.read("*n")
  end
end

local command = {}

for i_h = 1, h do
  local inc = i_h % 2 == 1 and 1 or -1
  local bg = i_h % 2 == 1 and 1 or w
  local ed = i_h % 2 == 1 and w or 1
  for i_w = bg, ed, inc do
    local src = getindex(i_h, i_w)
    if i_w == ed then
      if i_h ~= h then
        if map[src] % 2 == 1 then
          local dst = getindex(i_h + 1, i_w)
          local tmp = {i_h, i_w, i_h + 1, i_w}
          table.insert(command, tmp)
          map[src], map[dst] = map[src] - 1, map[dst] + 1
        end
      end
    else
      local dst = getindex(i_h, i_w + inc)
      if map[src] % 2 == 1 then
        local tmp = {i_h, i_w, i_h, i_w + inc}
        table.insert(command, tmp)
        map[src], map[dst] = map[src] - 1, map[dst] + 1
      end
    end
  end
end
print(#command)
for i = 1, #command do
  print(table.concat(command[i], " "))
end
