
object Main extends App {

  import scala.io.StdIn._
  val Array(h, w) = readLine.trim.split(' ').map(_.toInt)
  val state = Array.tabulate(h){_ ⇒ readLine.trim.split(' ').map(_.toInt)}
  var stack: List[CoordinatePair] = Nil
  for (i ← 0 until h){
    if (i % 2 == 0) {
      for (j ← 1 until w) {
        if (state(i)(j - 1) % 2 == 1){
          stack = CoordinatePair(Coordinate(i, j - 1), Coordinate(i, j))::stack
          state(i)(j - 1) -= 1
          state(i)(j) += 1
        }
      }
      if (state(i)(w - 1) % 2 == 1 && i + 1 < h){
        stack = CoordinatePair(Coordinate(i, w - 1), Coordinate(i + 1, w - 1))::stack
        state(i)(w - 1) -= 1
        state(i + 1)(w - 1) += 1
      }
    } else {
      for (j ← (1 until w).reverse) {
        if (state(i)(j) % 2 == 1){
          stack = CoordinatePair(Coordinate(i, j), Coordinate(i, j - 1))::stack
          state(i)(j) -= 1
          state(i)(j - 1) += 1
        }
      }
      if (state(i)(0) % 2 == 1 && i + 1 < h){
        stack = CoordinatePair(Coordinate(i, 0), Coordinate(i + 1, 0))::stack
        state(i)(0) -= 1
        state(i + 1)(0) += 1
      }
    }
  }
  println(stack.size)
  for (CoordinatePair(from, to) ← stack.reverse){
    println(
      s"${from.y + 1} ${from.x + 1} ${to.y + 1} ${to.x + 1}"
    )
  }
  case class Coordinate(y: Int, x: Int)
  case class CoordinatePair(from: Coordinate, to: Coordinate)
}
