Given n intervals \[l_1,r_1],\[l_2,r_2],…,\[l_n,r_n] and an integer x, you should find the size of the set S=y∣y=iANDx,,i∈\[l_1,r_1]∪\[l_2,r_2]∪…∪\[l_n,r_n], where iANDx is the bitwise and of integers i and x.
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains two integers n and x (1≤n≤5⋅103, 0≤x≤1018).
Each of the next n lines contains two integers l_i and r_i (0≤l_i≤r_i≤1018).
It is guaranteed that the sum of n over all test cases does not exceed 5⋅103.
For each test case, output an integer denoting the size of the set S.
For the first sample test case, we have S=0,1, so the answer is 2.
For the second sample test case, we have S=1,2,3, so the answer is 3.