import Data.Array 
import Control.Monad
import Control.Applicative

main = do
    [width, height] <- map read . words <$> getLine :: IO [Int]
    when (width/=0 || height/=0) $ do
        solve width height
        main

solve width height = do
    n <- read <$> getLine :: IO Int
    ngL <- replicateM n ((\[x,y]->(x,y)) . map read . words <$> getLine) :: IO [(Int, Int)]
    let ng = array ((1,1),(width,height)) 
             $ [((x,y), True)|x<-[1..width], y<-[1..height]] 
            ++ [((x,y), False)|(x,y)<-ngL] 
    print $ dp ng

dp ng = memo!(w,h) where
    (_, (w,h)) = bounds ng
    memo = array ((1,1), (w,h)) [((x,y), f x y)|y<-[1..h], x<-[1..w]]
    f 1 1 = 1
    f 1 y = if ng!(1,y) then memo!(1,y-1)                else 0
    f x 1 = if ng!(x,1) then memo!(x-1,1)                else 0
    f x y = if ng!(x,y) then memo!(x-1,y) + memo!(x,y-1) else 0

