import Control.Applicative ((<$>)) import Control.Monad (replicateM) import Data.List (nub) main :: IO () main = do w <- readLn h <- readLn n <- readLn solve w h n <$> replicateM n (map read <$> words <$> getLine) >>= print solve :: Int -> Int -> Int -> [[Int]] -> Int solve w h n sks = h * ls + w * lk - ls * lk - n where ls = length . nub . map (!! 0) $ sks lk = length . nub . map (!! 1) $ sks