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)
    throw new NullPointerException
    val moveFlags = evenResolution(zigzag.map(_._1))
    val moves: Seq[(Int, Int, Int, Int)] = {
      for((moveFlag, index) <- moveFlags.zipWithIndex;
          (y1, x1) <- Some(zigzag(index)._2) if moveFlag == 1;
          (y2, x2) <- Some(zigzag(index + 1)._2)) yield (y1, x1, y2, x2)
    }

    println(moves.length)
    for ((a, b, c, d) <- moves) println(s"$a $b $c $d")
  }

}
