module S = Set.Make (struct type t = int let compare = (-) end) let () = let w, h, n = Scanf.scanf "%d %d %d " (fun w h n -> w, h, n) in let rec read i ss ks = if i = n then S.cardinal ss, S.cardinal ks else let s, k = Scanf.scanf "%d %d " (fun s k -> s, k) in let s, k = s - 1, k - 1 in read (i + 1) (S.add s ss) (S.add k ks) in let ns, nk = read 0 S.empty S.empty in ns * h + w * nk - ns * nk - n |> Printf.printf "%d\n"