use std::io::Read; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let w: u64 = itr.next().unwrap().parse().unwrap(); let h: u64 = itr.next().unwrap().parse().unwrap(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut st1 = std::collections::HashSet::new(); let mut st2 = std::collections::HashSet::new(); for _ in 0..n { let s: u64 = itr.next().unwrap().parse().unwrap(); let k: u64 = itr.next().unwrap().parse().unwrap(); st1.insert(s); st2.insert(k); } println!( "{}", w * h - (w - st1.len() as u64) * (h - st2.len() as u64) - n as u64 ); }