module Main where

import           Control.Monad
import Control.Monad.Writer


newtype DiffList a = DiffList { getDiffList :: [a] -> [a] }  
toDiffList :: [a] -> DiffList a  
toDiffList xs = DiffList (xs++)  
  
fromDiffList :: DiffList a -> [a]  
fromDiffList (DiffList f) = f []  

instance Monoid (DiffList a) where  
    mempty = DiffList (\xs -> [] ++ xs)  
    (DiffList f) `mappend` (DiffList g) = DiffList (\xs -> f (g xs))  

main :: IO ()
main = do
    [h, _] <- (map read . words) <$> getLine
    list   <- map (map read . words) <$> (replicateM h) getLine
    let w=do
            res<-(sequence . map goRight . enumerate2d) list
            (goRight . map last) res
            return ()
    let (_,log)=runWriter w

    putStr
        $(unlines .((show . length) log :) . map ((unwords . map show) . (\((a, b), (c, d)) -> [a, b, c, d])))
        log

goRight
    :: [((Int, Int), Int)] -> Writer [((Int, Int), (Int, Int))] [((Int, Int), Int)]
goRight []  = return []
goRight [x] = return [x]
goRight (a@(aPoint, aValue) : b@(bPoint, _) : xs) = do
    if even aValue then
        do
            res<-goRight (b : xs)
            return $ a:res
    else
        do
            res<-goRight (mapSnd (+ 1) b : xs)
            tell [(aPoint, bPoint)]
            return $ mapSnd (subtract 1) a : res

enumerate :: [a] -> [(Int, a)]
enumerate = zip [1 ..]

enumerate2d :: [[a]] -> [[((Int, Int), a)]]
enumerate2d =
    (map (\(y, a) -> (map (\(x, b) -> ((y, x), b)) . enumerate) a) . enumerate)

mapTuple :: (t1 -> a) -> (t2 -> b) -> (t1, t2) -> (a, b)
mapTuple f1 f2 (a, b) = (f1 a, f2 b)

mapFst :: (t1 -> a) -> (t1, b) -> (a, b)
mapFst = flip mapTuple id

mapSnd :: (t2 -> b) -> (a, t2) -> (a, b)
mapSnd = mapTuple id
    