Given interval sets and in [0,n], which contain intervals and intervals, respectively, find the number of common subintervals whose length is . Note that there are points (including the start point and the end point) of the common subintervals that meet the conditions. The length is actually , and overlap is allowed. Refer to the example for details.
输入格式
The first line is a positive integer , which means the number of data groups; in each group of data, the first line is a positive integer , , , ; the next lines, each line has two positive integers , , which means The start and end points of the sub-intervals; in the next rows, two positive integers and in each line represent the start and end points of the sub-intervals. Among them, , , , . The data guarantees that sub-intervals do not cross each other, and sub-intervals do not cross each other.
输出格式
For each set of data, output the number of common subintervals that meet the conditions.
In sample 1, the subintervals are {1,3}{10,10}{5,8}, and the subintervals are {10,10}{1,8}; their common subintervals with length are respectively {1,3}{5,7}{6,8}, so the answer is .