A little-known fact about Santa is that he hates having to eat cookies every time he delivers presents. More accurately, he likes cookies but thinks that the ones he has to eat have too much butter in them and not enough cheese.
This year, Mrs. Clause has helped him by giving him cookbooks. The th cookbook has a recipe that calls for anywhere between to blocks of cheese, inclusive.
Since Santa doesn't want to read all of these cookbooks, he makes you do it for him. To test your knowledge, Santa will ask you questions each containing an integer . For each question, you must find the number of cookbooks that allow putting blocks of cheese in the cookies.
Input Specification
The first line of input will contain two space-separated integers, and .
The next lines will each contain two space-separated integers, and .
The next lines will each contain one integer, .
Output Specification
For each question, output the number of cookbooks that satisfy the above condition on a separate line.
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No further constraints.
Sample Input
4 2
1 10
5 6
3 8
2 3
6
9
Sample Output
3
1
Explanation for Sample Output
For the first query, cookbooks , , and allow using blocks of cheese.
For the second query, only cookbook allows using blocks of cheese.
Comments