Renat Mullakhanov (rem), one of the most talented programmers in the world, passed away on March 11, 2011. This is very sad news for all of us. His team went to ACM ICPC World Finals - 2004, placed 4th and won gold medals. He really was a great programmer. May he rest in peace. This problem is dedicated to him.
2DPlaneLand is a land just like a huge 2D plane. The range of X axis is 0 to 109 and the range of Y axis is also 0 to 109. People built houses only in integer co-ordinates and there is exactly one house in each integer co-ordinate.
Now UseAndSmile Soap Company is launching a new soap. That's why they want to advertise this product as much as possible. So, they selected n persons for this task. Each person will be given a rectangular region. He will advertise the product to all the houses that lie in his region. Each rectangular region is identified by 4 integers x1, y1, x2 and y2. That means this person will advertise in all the houses whose x co-ordinate is between x1 and x2 (inclusive) and y co-ordinate is between y1 and y2 (inclusive).
Now after a while they realized that some houses are being advertised by more than one person. So, they want to find the number of houses that are advertised by at least k persons. Since you are one of the best programmers in the city; they asked you to solve this problem.
Input
Input starts with an integer T (≤ 13), denoting the number of test cases.
Each case starts with a line containing two integers n (1 ≤ n ≤ 30000), k (1 ≤ k ≤ 10). Each of the next n lines will contain four integers x1, y1, x2, y2 (0 ≤ x1, y1, x2, y2 ≤ 109, x1 < x2, y1 < y2) denoting a rectangular region for a person.
Output
For each case, print the case number and the total number of houses that are advertised by at least k people.
Sample
Sample Input | Sample Output |
---|---|
2 2 1 0 0 4 4 1 1 2 5 2 2 0 0 4 4 1 1 2 5 | Case 1: 27 Case 2: 8 |