// http://yukicoder.me/problems/30 open System let dprintfn fmt = Printf.kprintf Diagnostics.Debug.WriteLine fmt [] let main argv = let W = Console.ReadLine().Trim() |> int let H = Console.ReadLine().Trim() |> int let N = Console.ReadLine().Trim() |> int let suits = Array.create (W) false let nums = Array.create (H) false let w = ref 0 let h = ref 0 for i=1 to N do let S, K = Console.ReadLine().Trim().Split([|' '|]) |> Array.map int |> fun a -> a.[0]-1, a.[1]-1 if suits.[S] = false then incr w suits.[S] <- true if nums.[K] = false then incr h nums.[S] <- true let W = int64 W let H = int64 H let w = int64 !w let h = int64 !h let ans = W*H - (W - w)*(H - h) - int64 N printfn "%d" ans 0