using System; using System.Collections.Generic; using System.Linq; namespace yukicoder { public class Program { public static void Main() { var h = int.Parse(Console.ReadLine()); var w = int.Parse(Console.ReadLine()); var n = int.Parse(Console.ReadLine()); var s = new bool[h, w, 2]; long sum = 0; for (var i = 0; i < n; i++){ var a = Console.ReadLine().Split(' ').Select(value => int.Parse(value) - 1).ToArray(); for(var j = 0; j < w; j++) { if (!s[a[0], j, 1]) { s[a[0], j, 0] = true; } } for(var j = 0; j < h; j++) { if (!s[j, a[1], 1]) { s[j, a[1], 0] = true; } } s[a[0], a[1], 1] = true; s[a[0], a[1], 0] = false; } for(var i = 0; i < h; i++) { for(var j = 0; j < w; j++) { if (s[i, j, 0]) { sum++; } } } Console.WriteLine(sum); } } }