import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Array.Unboxed

main :: IO ()
main = do
  [a,b] <- getl $ wrds toInt
  unless (a == 0 && b == 0) $ do
    n <- getl toInt
    solve a b <$> replicateM n (getl $ wrds toInt) >>= print
    main

solve :: Int -> Int -> [[Int]] -> Int
solve a b xs = (! (a,b)) $ foldl g ia [(i,j) | i <- [2..a],j <- [2..b]]
  where
    f i j = [i,j] `elem` xs
    ia = accumArray (+) 0 ((1,1),(a,b)) ([((i,1),1)|i <- [1..a]] ++ [((1,j),1)|j <- [2..b]]) :: UArray (Int,Int) Int
    g ar (i,j) = if f i j then ar // [((i,j),0)] else ar // [((i,j),ar ! (i-1,j) + ar ! (i,j-1))]

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine