import Control.Monad
import Data.List
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as B

main = do
    (h:w:_)<-map read.words<$>getLine::IO[Int]
    as <- replicateM h $ map read.words<$>getLine::IO[[Int]]
    let ass = listArray ((1,1),(h,w)) $ concat as :: UArray (Int,Int) Int
    let bs = listArray (1,h) $ map sum as :: UArray Int Int
    --
    ans1 <- (<$>) concat $ forM [1..h] $ \ih -> do
        let ows = fiw ih w ass 1
        return $ pairs ih w ows
    --
    let ans2 = (++) ans1 $ pairsh h w $ fih h bs 1
    print $ length ans2
    putStr $ unlines $ map (unwords.(map show)) ans2
--
fiw h w ass iw
    | iw > w = []
    | odd (ass ! (h,iw)) = iw : fiw h w ass (iw+1) 
    | otherwise = fiw h w ass (iw+1)
fih h bs ih
    | ih > h = []
    | odd (bs ! ih) = ih : fih h bs (ih+1) 
    | otherwise = fih h bs (ih+1)
--
pairs _ _ [] = []
pairs h w [x]
    | w == x = []
    | otherwise = mvw h x w
pairs h w (f:t:r) = mvw h f t ++ pairs h w r
--
mvw h f t = map (\i->[h,i,h,i+1])  [f..t-1]
--
pairsh _ _ [] = []
pairsh h w [x] = []
pairsh h w (f:t:r) = mvh w f t ++ pairsh h w r
--
mvh w f t = map (\i->[i,w,i+1,w]) [f..t-1]
