defmodule Main do def main do w = IO.read(:line) |> String.trim() |> String.to_integer() h = IO.read(:line) |> String.trim() |> String.to_integer() n = IO.read(:line) |> String.trim() |> String.to_integer() {s, k} = for _ <- 0..(n - 1) do IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1) end |> Enum.reduce({[], []}, fn [s, k], {sq, kq} -> {[s | sq], [k | kq]} end) s = s |> Enum.uniq() |> length() k = k |> Enum.uniq() |> length() IO.puts(w * k + s * h - s * k - n) end end