A rectangle has corners (0,0), (W,0), (0,H), and (W,H). There are N cut segments, each parallel to a side. Segment i runs from (Ai,Bi) to (Ci,Di) with exactly one of Ai=Ci or Bi=Di. Parallel segments never share a point, and no parallel segment touches the paper border. After cutting along every segment, how many pieces remain?
The first line has W, H, and N. The next N lines give each segment's endpoints.
Print the number of pieces on one line.
1≤W,H≤109, 1≤N≤105.