{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Data.List import Text.Printf import Debug.Trace main = do [w] <- getInts [h] <- getInts [n] <- getInts xxs <- replicateM (fromInteger n) getInts let xl = fromIntegral $ length $ nub $ map head xxs let yl = fromIntegral $ length $ nub $ map (head . tail) xxs print $ xl * h + yl * w - xl * yl - n -- util getInts :: IO [Integer] getInts = map (fst . fromJust . B.readInteger) . B.words <$> B.getLine substr :: Int -> Int -> B.ByteString -> B.ByteString substr b l s = B.take l $ B.drop b s