import std.algorithm, std.array, std.container, std.range; import std.string, std.conv, std.math; import std.stdio, std.typecons; alias Tuple!(long, "s", long, "k") card; void main() { auto w = readln.chomp.to!long; auto h = readln.chomp.to!long; auto n = readln.chomp.to!long; auto ci = iota(n).map!((i) { auto rd = readln.split.map!(to!long); return card(rd[0], rd[1]); }).array; auto s = ci.map!(c => c.s).array.sort.uniq.array.length; auto k = ci.map!(c => c.k).array.sort.uniq.array.length; writeln(ci.map!(c => c.k).uniq.array); writeln(w * k + s * h - s * k - ci.length); }