object Main extends App {
  def mkRow(height: Int, rows: List[List[Boolean]]): List[Boolean] = {
    if (rows.length == height) rows.reverse.flatten
    else {
      val coins = io.StdIn.readLine().split(" ").map(_.toInt % 2 == 1).toList
      val row = if (rows.length % 2 == 0) coins else coins.reverse
      mkRow(height, row :: rows)
    }
  }

  def checkIndex(width: Int, index: Int, prev: Boolean, row: List[Boolean], res: List[(Int, Int, Int, Int)]): List[(Int, Int, Int, Int)] = {
    if (row.isEmpty) res.reverse
    else {
      if (prev) {
        val y = index / width
        val y_ = (index + 1) / width
        val x = if (y % 2 == 0) index % width else width - index % width - 1
        val x_ = if (y_ % 2 == 0) (index + 1) % width else width - ((index + 1) % width) - 1
        checkIndex(width, index + 1, !row.head, row.tail, (x, y, x_, y_) :: res)
      }
      else checkIndex(width, index + 1, row.head, row.tail, res)
    }
  }

  val hw = io.StdIn.readLine().split(" ").map(_.toInt)
  val H = hw(0)
  val W = hw(1)
  val grid = mkRow(H, List())
  val processes = checkIndex(W, 0, grid.head, grid.tail, List())
  println(processes.length)
  processes.foreach(elem => println(elem._1 + " " + elem._2 + " " + elem._3 + " " + elem._4))
}
