loop {
  a, b = gets.split.map &:to_i
  break if a == 0
  x = gets.to_i.times.map { Complex(*gets.split) }
  dp = Hash.new 0
  dp[1 + 1i] = 1
  (1..a).each {|i|
    (1..b).each {|j|
      z = Complex(i, j)
      if !x.include?(z)
        dp[z] += dp[z-1] + dp[z-1i]
      end
    }
  }
  p dp[Complex(a, b)]
}

