Paper cutting - MarisaOJ: Marisa Online Judge
Given a sheet of paper with dimensions H×W. Cut n parallel cuts along the edges of the paper, and determine how many parts the paper is divided into.
### Input
- The first line contains three integers W, H, and n.
- The next n lines each contain four integers x1, y1, x2, y2, indicating a cut from position (x1,y1) to (x2,y2).
### Output
- Print an integer representing the number of parts the paper is divided into.
### Constraints
- 1≤n≤105.
- 1≤W,H≤109.
- 1≤x1≤x2≤W.
- 1≤y1≤y2≤H.
### Example
Input:
10105606706762393232101989
Output:
4
Topic
Data structure
DSU
Rating
2300
Source
JOI
Solution (0)
Solution