# AndInt

It's again the hiring season! Our friends at Take Off Labs wanted to go off the beaten track and challenge the aspiring engineers with some more difficult problems. Since nobody managed to solve this one during the interviews, we're giving it to you to solve. But beware that you don't have much time either, you must finish this problem before Mindcoding Round #3 ends! So, without further introductions, here it is:

You are given several queries, each of the form of a closed interval [x, y]. You are to find, for each such query, how many subintervals [i, j] exist (x ≤ i ≤ j ≤ y) such that (i AND (i+1) AND … AND j) > 0.

Since this number can be very large, you should print it modulo 109+7.

### Input

The first line of input contains a single integer Q - the number of queries you have to answer.
Each of the following Q lines contain two space separated values, x and y.

### Output

The output should contain the answers to all Q queries, each on a separate line.

### Constraints

• 1 ≤ Q ≤ 10
• 1 ≤ x ≤ y ≤ 109
• AND refers to the bitwise operator.

### Sample

InputOutputExplanation
2
3 6
42 43
7
3
In the first case, there are 7 valid intervals:
• [3, 3]
• [4, 4]
• [4, 5]
• [4, 6]
• [5, 5]
• [5, 6]
• [6, 6]
In the second case, there are only 3 valid intervals:
• [42, 42]
• [42, 43]
• [43, 43]
Questions?