Up posture of the refresh interval
Value_Dragon is a rich man. New Year approached, so he was prepared red envelopes. But his red envelopes way is wonderful. He let n individuals in a row. Each selection period interval [l, r] in the 1-n send, to each individual section of a dollar. So made m times red. He wanted to know how much hair after intervals meet the following requirements in sub-interval [1, n] in there
-
The total number of not less than this interval to get the money s
-
The total number of this range may be divided into two disjoint sub-intervals each subinterval obtained and money is not less than w
(Note: a range of sub-intervals including itself)
Anti-pit reminders, such as a length of the interval [1,1], can not be split into two subintervals
The first row is an array of data T represents the integer.
Next, with a T set of data
at the beginning of each data of four integers representing nmsw
Next m lines, each line is the two numbers L, r represents about interval [L, r] endpoint
Where T <= 10
n<=10^6,m<=10^5
0<l<=r<=n
0<=w<=s<10^8
For each interval the number of data output line, meet the requirements of the representative
4 1 0 0 0 1000000 0 0 0 1000000 1 0 0 1 1000000 10 10 20 14 2 10 5 9 5 5 6 8 2 6 9 10 6 7 6 10 4 5 5 7
0 499999500000 499999500000 8