import scala.math._

object Main {
  val sc = new java.util.Scanner(System.in)
  def main(args: Array[String]) {
    while(true) {
      val a, b = sc.nextInt()
      if(a == 0 && b == 0) {
        return
      }

      val n = sc.nextInt()
      val dp = Array.ofDim[Long](a+1, b+1)
      for(i <- 1 to n) {
        val x, y = sc.nextInt()
        dp(x)(y) = -1
      }
      dp(1)(1) = 1
      for(i <- 1 to a; j <- 1 to b; if (i, j) != (1, 1)) {
        if(dp(i)(j) == -1) {
          dp(i)(j) = 0
        } else {
          dp(i)(j) = dp(i-1)(j) + dp(i)(j-1)
        }
      }
      println(dp(a)(b))
    }
  }
}