import java.util.Comparator
import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	while(true){
		val a = scn.nextInt()
		val b = scn.nextInt()
		if (a==0 && b==0) break
		val n = scn.nextInt()
		val ngs = Array(n){Pair(scn.nextInt()-1, scn.nextInt()-1)}
		ngs.sortWith(Comparator { o1, o2 ->
			if (o1.first!=o2.first) o1.first-o2.first
			else o1.second-o2.second
		})

		var k = 0
		val map = Array(a){IntArray(b){0} }
		for (i in map.indices){
			for (j in map[i].indices){
				if (i==0 && j==0) {
					map[0][0]=1
					continue
				}
				if (k<ngs.size && ngs[k].first==i && ngs[k].second==j) k++
				else {
					map[i][j] = when {
						i==0 -> map[i][j-1]
						j==0 -> map[i-1][j]
						else -> map[i-1][j] + map[i][j-1]
					}
				}
			}
		}
		println(map.last().last())
	}
}
