Christmas is coming! Teo has already decided to decorate his terrace.
Teo has a big rectangular-shaped terrace. It is meters long and meters wide. Teo has decided to decorate his terrace in a very strange way. Instead of hanging Christmas lights on the edges of his terrace, he will put them on the floor!
Teo has lamps, two per each of colours. He will put each in some position , where represents the distance from the left side of the terrace and from the bottom side.
Proud of how he decorated the terrace, he decided to take the rest of his day off. But soon, he got bored, so he returned to the terrace. He started counting nice rectangles on the terrace. A rectangle is nice if, for each colour, both lamps are either inside or outside of the rectangle. If a lamp is located on the rectangle edge, it is considered to be inside of it.
Teo has realized that counting nice rectangles is not an easy job. He is interested in how many nice rectangles are there, whose corners have integer distances from the bottom and left sides of the terrace. All rectangles we consider are parallel with terrace sides. This is where you step in! Count the number of nice rectangles.
Input Specification
The first line contains three integers , the length and the width of the terrace, and the number of lamp colours.
The next lines contain four numbers , positions of the first and the second lamp of the -th colour.
Output Specification
In a single line, output the number of nice rectangles.
Constraints
Subtask | Points | Constraints |
---|---|---|
for each lamp colour | ||
, | ||
No additional constraints. |
Sample Input 1
2 2 1
0 0 1 2
Sample Output 1
3
Explanation for Sample Output 1
The image shows all the nice rectangles from the first example.
Sample Input 2
3 3 0
Sample Output 2
36
Sample Input 3
3 3 5
0 0 0 0
0 0 1 3
0 0 3 1
1 3 3 1
1 3 3 1
Sample Output 3
7
Comments