Given a permutation $$$p$$$ of length $$$n$$$, consider the undirected simple graph $$$G$$$ with $$$n$$$ vertices constructed as follows.
Given an integer $$$K$$$ and $$$n$$$ non-negative integers $$$b_1, b_2, \dots b_n$$$, compute the number of non-empty subsequences $$$s$$$ of $$$\{1, 2, \dots n\}$$$ such that
$$$$$$b_{s_1} \oplus b_{s_2} \oplus \dots b_{s_{|s|}} = K$$$$$$
and the set of nodes $$$s$$$ forms an independent set in $$$G$$$. Here, $$$\oplus$$$ represents the bitwise XOR operation.
The first line of the input contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$K$$$ ($$$2 \le n \le 10^3, 0 \le K \lt 2^{10}$$$).
The second and third lines of each test case contain the permutation $$$p$$$ and the sequence $$$b$$$ respectively ($$$1 \le p_i \le n, 0 \le b_i \lt 2^{10}$$$). It is guaranteed that $$$p$$$ is a permutation.
It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^3$$$.
For each test case, print a single integer on a new line, the answer to the problem modulo $$$10^9 + 7$$$.
25 15 2 3 1 40 1 1 1 16 04 3 1 6 2 52 1 2 0 2 1
5 5
In the first test case, the $$$5$$$ independent sets satisfying the conditions above are $$$\{1\}$$$, $$$\{2\}$$$, $$$\{3\}$$$, $$$\{4\}$$$ and $$$\{1, 5\}$$$.
| Name |
|---|


