import Control.Monad import qualified Data.Set as S nub' = S.toList . S.fromList main = do [w,h,n] <- map read <$> replicateM 3 getLine sks <- map (map read . words) . lines <$> getContents print (match w h n sks) match :: Integer -> Integer -> Integer -> [[Integer]] -> Integer match w h n sks = ns*h + nk*w - ns*nk - n where ns = (fromIntegral . length . nub' . map head) sks nk = (fromIntegral . length . nub' . map last) sks