import java.util.Scanner object Problem011 { def proc(markKinds: Int, suitKinds: Int, handNum: Int, hand: Seq[(Int, Int)]): Long = { val handMarkNum = hand.map(x => x._1).distinct.size val handSuitNum = hand.map(x => x._2).distinct.size val matchCount: Long = handMarkNum * suitKinds + handSuitNum * markKinds val doubleCount: Long = handMarkNum * handSuitNum matchCount - doubleCount - handNum } def main(args: Array[String]) = { val sc = new Scanner(System.in) val w = sc.nextInt() val h = sc.nextInt() val n = sc.nextInt() val sk: Seq[(Int, Int)] = Seq.fill(n)(sc.nextInt(), sc.nextInt()) val result = proc(w, h, n, sk) println(result) } }