let () = Scanf.scanf "%d %d\n" @@ fun h w ->
  let ass =
    Array.init h @@ fun _ ->
      Array.init w @@ fun _ ->
        Scanf.scanf "%d " @@ fun a -> a in
  let moves = ref [] in
  for i = 0 to h - 1 do
    if i mod 2 = 0 then begin
      for j = 0 to w - 2 do
        if ass.(i).(j) mod 2 = 1 then begin
          ass.(i).(j + 1) <- 1 + ass.(i).(j + 1);
          moves := (i, j, i, j + 1) :: !moves
        end
      done;
      if ass.(i).(w - 1) mod 2 = 1 && i + 1 < h then begin
        ass.(i + 1).(w - 1) <- 1 + ass.(i + 1).(w - 1);
        moves := (i, w - 1, i + 1, w - 1) :: !moves
      end
    end else begin
      for j = w - 1 downto 1 do
        if ass.(i).(j) mod 2 = 1 then begin
          ass.(i).(j - 1) <- 1 + ass.(i).(j - 1);
          moves := (i, j, i, j - 1) :: !moves
        end
      done;
      if ass.(i).(0) mod 2 = 1 && i + 1 < h then begin
        ass.(i + 1).(0) <- 1 + ass.(i + 1).(0);
        moves := (i, 0, i + 1, 0) :: !moves
      end
    end
  done;
  Printf.printf "%d\n" (List.length !moves);
  if !moves = [] then print_newline ()
  else List.iter (fun (y, x, y', x') ->
    Printf.printf "%d %d %d %d\n" (y + 1) (x + 1) (y' + 1) (x' + 1)) !moves

                
            

