d=Array.new(17).map{Array.new(17,0)}
d[0][0]=1;
gx,gy=gets.split.map(&:to_i)
gets.to_i.times{
  x,y=gets.split.map(&:to_i)
  d[x-1][y-1]=-1;
}
0.upto(gx-1){|i|
  0.upto(gy-1){|j|
    next if d[i][j]==-1
    if i && d[i-1][j]!=-1
      d[i][j]+=d[i-1][j] end
    if j && d[i][j-1]!=-1
      d[i][j]+=d[i][j-1] end
  }
}
puts d[gx-1][gy-1]