loop {
	a, b = gets.split.map &:to_i
	break if a == 0
	n = gets.to_i
	hash = {}
	n.times {
		hash[gets.split.map &:to_i] = 1
	}

	way = (0..a).map{ [0] * (b+1) }
	way[1][1] = 1

	(1..a+b-1).each{|d|
		x = 1
		y = d + 1
		loop {
			if x <= a && y <= b && !hash[[x,y]]
				way[x][y] = way[x-1][y] + way[x][y-1]
			end
			x += 1
			y -= 1
			break if y <= 0
		}
	}
	p way[a][b]
}