import Control.Monad ( replicateM ) import Data.Char ( isSpace ) import qualified Data.List as L import qualified Data.ByteString.Char8 as BSC8 input :: Int -> IO [[Int]] input n = replicateM n $ my <$> BSC8.getLine where my :: BSC8.ByteString -> [Int] my = L.unfoldr f where f s = do (n, s') <- BSC8.readInt s return (n, BSC8.dropWhile isSpace s') main :: IO () main = do w <- readLn :: IO Int h <- readLn :: IO Int n <- readLn :: IO Int xss <- input n let x = L.length $ L.nub $ L.map L.head xss y = L.length $ L.nub $ L.map L.last xss a = w * h - ((w - x) * (h - y) + n) print a