object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.{readLine, readInt}
    while (true) {
      val Array(nx, ny) = readLine().split(' ').map(_.toInt)
      if (nx == 0 && ny == 0) return
      val n = readInt()
      val stop = (0 until n).map(_ => readLine().split(' ').map(_.toInt)).map{case Array(x, y) => (x, y)}.toSet
      println(count(nx, ny, stop))
    }
  }

  def count(nx: Int, ny: Int, stop: Set[(Int, Int)]): Int = {
    val memo = Array.fill(nx + 1, ny + 1)(0)
    memo(1)(1) = 1
    for {
      x <- 1 to nx
      y <- 1 to ny if !stop.contains((x, y)) && (x, y) != (1, 1)
    } {
      memo(x)(y) = memo(x - 1)(y) + memo(x)(y - 1)
    }
    memo(nx)(ny)
  }
}

