loop do
    a, b = gets.split.map(&:to_i)
    break if !a && !b

    dp = Array.new(a + 1, 0).map{Array.new(b + 1, 0)}
    n = gets.chomp.to_i
    n.times do
        x, y = gets.split.map(&:to_i)
        dp[x][y] = nil
    end

    dp[0][1] = 1
    for i in 1..a do
        for j in 1..b do
            if dp[i][j] == nil
                dp[i][j] = 0
            else
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
            end
        end
    end

    puts dp[a][b]
end