def main w = gets.to_i h = gets.to_i n = gets.to_i w_list = [nil]*(w+1) h_list = [nil]*(h+1) n.times do s,k = gets.split.map(&:to_i) w_list[s] = true if w_list[s].nil? h_list[k] = true if h_list[k].nil? end not_used = (w - (w_list.compact!.length)) * (h - (h_list.compact!.length)) ans = w * h - not_used - n end puts main()