
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Array
import Data.Array.IO
import Data.Array.MArray
import Control.Monad
import Data.IORef

main::IO()
main=do
  hwc<-getLine
  let h:w:[]=map read (words hwc)::[Int]
  ar<-getter h w
  ref1<-newIORef []
  ref2<-newIORef []
  forM_ [(i,j)|i<-[1..h],j<-[1..(w-1)]] (\ (i,j) -> do
                                                    v<-readArray ar (i,j)
                                                    u<-readArray ar (i,j+1)
                                                    case (mod v 2) of
                                                          0 -> return ()
                                                          1 -> do
                                                                val<-readIORef ref1
                                                                writeIORef ref1 ((i,j):val)
                                                                writeArray ar (i,j) (v-1)
                                                                writeArray ar (i,j+1) (u+1)
                                                                return () )
  forM_ [1..(h-1)] (\ i -> do
                            v<-readArray ar (i,w)
                            u<-readArray ar (i+1,w)
                            case (mod v 2) of
                              0 -> return ()
                              1 -> do
                                    val<-readIORef ref2
                                    writeIORef ref2 ((i,w):val)
                                    writeArray ar (i,w) (v-1)
                                    writeArray ar (i+1,w) (u+1)
                                    return ())
  hori_moves<-readIORef ref1
  virt_moves<-readIORef ref2
  print (length (hori_moves++virt_moves))
  forM_ (reverse hori_moves) horiz_move
  forM_ (reverse virt_moves) virt_move

horiz_move::(Int,Int)->IO ()
horiz_move (i,j) = let i_s = show  i in
                   let j_s = show  j in
                   let jj_s = show (j+1) in
                   putStr (concat [i_s," ",j_s," ",i_s," ",jj_s,"\n"])

virt_move::(Int,Int)->IO ()
virt_move (i,j) = let i_s = show  i in
                   let j_s = show  j in
                   let ii_s = show (i+1) in
                   putStr (concat [i_s," ",j_s," ",ii_s," ",j_s,"\n"])

getter::Int->Int->IO (IOArray (Int,Int) Int)
getter h w = do
  d<-forM [1..h] (\ _ -> getLine)
  let dat = map read (concat (map words d)) ::[Int]
  ar<-newListArray ((1,1),(h,w)) dat
  return ar