Problem I. Innocence
时间限制 1000 ms
内存限制 256 MB
David is a young child. He likes playing combinatorial games, for example, the Nim game. He is just an amateur but he is sophisticated with game theory. This time he has prepared a problem for you.
Given integers $N, L, R$ and $K$, you are asked to count in how many ways one can arrange an integer array of length $N$ such that all its elements are ranged from $L$ to $R$ (inclusive) and the bitwise exclusive-OR of them equals to $K$. To avoid calculations of huge integers, print the number of ways in modulo $(10^9 + 7)$.
In addition, David would like you to answer with several integers $K$ in order to ensure your solution is completely correct.
输入数据
输出数据
For each query, print the answer modulo $(10^9 + 7)$ in one line.
样例输入
复制
3
2 3 4 2
0 7
3 3 4 2
3 4
5 5 7 4
5 6 7 8
样例输出
样例说明
In the first sample, there are two ways to select one number 3 and one number 4 such that the exclusive-OR of them is 7. In the second sample, there are three ways to select one number 3 and two numbers 4 and one way to select three numbers 3 such that the exclusive-OR of them is 3.
$ Mathjax font initiator $