### main

loop do
  a, b = gets.strip.split(' ').map{|s| s.to_i}
  break if (a | b) == 0

  n = gets.strip.to_i

  rts = b.times.map{a.times.map{nil}}

  n.times do
    x, y = gets.strip.split(' ').map{|s| s.to_i - 1}
    rts[y][x] = 0
  end

  rts[b - 1][a - 1] = 1

  (a + b - 3).downto(0) do |xy|
    for x in (0..xy)
      y = xy - x
      if (x >= 0 && x < a && y >= 0 && y < b)
        if rts[y][x].nil?
          rt = 0
          rt += rts[y][x + 1] if x < a - 1
          rt += rts[y + 1][x] if y < b - 1
          rts[y][x] = rt
        end
      end
    end
  end

  puts rts[0][0]
end