open Printf open Scanf
module MyInt = struct let (+) = (+) let (-) = (-) let (/) = (/) let ( * ) = ( * ) let (mod) = (mod) let (%) = (mod) let (+=) r v = r := !r + v let (-=) r v = r := !r - v let ( *=) r v= r := !r * v let (/=) r v = r := !r / v end
module MyInt64 = struct
	let (+$) = (+) let (-$) = (-) let (/$) = (/) let ( *$) = ( * ) let (+) p q = Int64.add p q let (-) p q = Int64.sub p q let ( * ) p q = Int64.mul p q let (/) p q = Int64.div p q let (+=) r v = r := !r + v let (-=) r v = r := !r - v let ( *=) r v= r := !r * v let (/=) r v = r := !r / v let labs p = if p < 0L then -1L*p else p let (~|) p = Int64.to_int p let (~~|) p = Int64.of_int p let input_i64_array n = Array.init (~| n) (fun _ -> Scanf.scanf " %Ld" (fun v -> v)) let get_i64 _ = Scanf.scanf " %Ld" (fun v -> v) let get_2_i64 _ = Scanf.scanf " %Ld %Ld" (fun u v -> u,v) let get_3_i64 _ = Scanf.scanf " %Ld %Ld %Ld" (fun u v w -> u,v,w) let get_4_i64 _ = Scanf.scanf " %Ld %Ld %Ld %Ld" (fun u v w x -> u,v,w,x) let get_5_i64 _ = Scanf.scanf " %Ld %Ld %Ld %Ld %Ld" (fun u v w x y -> u,v,w,x,y) let print_i64_endline n = n |> Int64.to_string |> print_endline let (mod) m n = m - (m/n) * n let (%) = (mod) let rec gcd m n = match m,n with | m,0L -> m | m,n -> gcd n (m mod n) let lcm m n = (m*n) / gcd m n let rep from_ to_ fbod = let i,f = ref ~|from_,ref true in while !i <= ~|to_ && !f do match fbod ~~| !i with | `Break -> f := false | _ -> i := !i +$ 1; done
	let string_of_list ?(separator=" ") f ls = let rec f0 a s = match a with | [] -> s | [h] -> s ^ (f h) ^ separator | h::t -> f0 t (s ^ (f h) ^ separator) in f0 ls "" let char_list_of_string str = let rec f0 i a = if i<0 then a else f0 (i-$1) (str.[i]::a) in f0 (String.length str -$ 1) [] let string_of_char_list ls = List.fold_left (fun u v -> u ^ (String.make 1 v)) "" ls
	let (@@@) = (@) let (@) a i = a.(~|i) let (<@) a (i,v) = a.(~|i) <- v
	let ceildiv m n = (m+n-1L) / n
end open MyInt64
let (@) a (i,j) = a.(~|i).(~|j) let (<@) a (i,j,v) = a.(~|i).(~|j) <- v let (<+) a (i,j,v) = a.(~|i).(~|j) <- v + a.(~|i).(~|j)

let () =
	let h,w = get_2_i64 0 in
	let a = Array.init (~|h) (fun _ -> input_i64_array w)
	in
	let ls = ref [] in
	rep 0L (h-2L) (fun i ->
		rep 0L (w-2L) (fun j ->
			if (a@(i,j)) mod 2L = 1L then (
				a<+(i,j,-1L);
				a<+(i,j+1L,1L);
				ls := (i,j,i,j+1L)::!ls;
			); `Ok
		);
		let j = w-1L in
		if (a@(i,j)) mod 2L = 1L then (
			a<+(i,j,-1L);
			a<+(i+1L,j,1L);
			ls := (i,j,i+1L,j)::!ls;
		);
		`Ok
	);
	let i = h-1L in
	rep 0L (w-2L) (fun j ->
		if (a@(i,j)) mod 2L = 1L then (
			a<+(i,j,-1L);
			a<+(i,j+1L,1L);
			ls := (i,j,i,j+1L)::!ls;
		); `Ok
	);
	printf "%d\n" @@ List.length !ls;
	List.iter (fun (p,q,r,s) -> let p,q,r,s = p+1L,q+1L,r+1L,s+1L
	in printf "%Ld %Ld %Ld %Ld\n" p q r s) @@ List.rev !ls;

