object Main {
  import java.util.Scanner

  def readStrings(n: Int)(implicit sc: Scanner): Array[String] = Array.fill(n) { sc.next() }
  def readInts(n: Int)(implicit sc: Scanner): Array[Int] = Array.fill(n) { sc.nextInt() }
  def readLongs(n: Int)(implicit sc: Scanner): Array[Long] = Array.fill(n) { sc.nextLong() }
  def readLineStrings(implicit sc: Scanner): Array[String] = sc.nextLine().split(' ')
  def readLineInts(implicit sc: Scanner): Array[Int] = readLineStrings.map(_.toInt)
  def readLineLongs(implicit sc: Scanner): Array[Long] = readLineStrings.map(_.toLong)

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(implicit sc: Scanner): Unit = {
    def evenResolution(row: Seq[Int]): Seq[Int] = row.scanLeft(0){ (a, carry) => (a + carry) % 2 }.drop(1).dropRight(1)
    def flattenZigzag[A]: Array[Array[A]] => scala.collection.mutable.ArraySeq[A] = { array =>
      array.zipWithIndex.flatMap { case (elem, i) => if (i % 2 == 0) elem else elem.reverse }
    }

    val Array(h, w) = readLineInts
    val a = Array.fill(h)(readLineInts)
    val indexedCells = {
      a.zipWithIndex.map { case (row, rowIndex) =>
        row.zipWithIndex.map { case (cell, columnIndex) =>
          (cell, (rowIndex + 1, columnIndex + 1))
        }
      }
    }
    val zigzag = flattenZigzag(indexedCells)
    val moveFlags = evenResolution(zigzag.map(_._1))
    val moves: Seq[(Int, Int, Int, Int)] = {
      moveFlags.zipWithIndex.flatMap { case (moveFlag, index) =>
        if (moveFlag == 1) {
          val (y1, x1) = zigzag(index)._2
          val (y2, x2) = zigzag(index + 1)._2
          Some((y1, x1, y2, x2))
        } else None
      }
    }

    println(moves.length)
    moves.foreach(m => println(m._1 + " " + m._2 + " " + m._3 + " " + m._4))
  }
}
