import Control.Monad (forM_,replicateM)
import Control.Monad.ST (ST,runST)
import qualified Data.Array.ST as STArr

type Block = (Int,Int)

main = do
    [a,b] <- getLine >>= return . map read . words
    if all (==0) [a,b] then return () else do
        n <- readLn
        blocks <- replicateM n (getLine >>= return . block . map read. words)
        print $ countRoute a b blocks
        main

    where
    block [x,y] = (x,y)

countRoute :: Int -> Int -> [Block] -> Int
countRoute a b blocks = runST $ do
    counts <- STArr.newArray ((0,0),(a,b)) 0
        :: ST s (STArr.STUArray s (Int,Int) Int)

    STArr.writeArray counts (1,1) 1
    forM_ [(i,j)|i<-[1..a] ,j<-[1..b], (i,j) /= (1,1) && not ((i,j) `elem` blocks)]
        (updateCount counts)

    STArr.readArray counts (a,b)

    where
    updateCount counts (i,j) = do
        c1 <- STArr.readArray counts (i-1,j)
        c2 <- STArr.readArray counts (i,j-1)
        STArr.writeArray counts (i,j) (c1+c2)