| TheForces Round #31 (Div2.9-Forces) |
|---|
| Finished |
This time Yugandhar came up with two binary strings $$$a$$$ and $$$b$$$ of length $$$n$$$ and is thinking of asking you to construct a binary matrix which has $$$n$$$ rows and $$$n$$$ columns, such that the following condition holds:
But Wuhudsm thinks it is boring to concentrate on a single thing. Hence, he asked you to calculate the number of different binary matrices of size $$$n$$$ rows and $$$n$$$ columns which you can construct to make the above conditions hold.
The number may be large so print it modulo $$$10^{9}+7$$$.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10$$$). The description of the test cases follows.
The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$), the length of binary strings $$$a$$$ and $$$b$$$.
The second line of each testcase contains a binary string $$$a$$$ of length $$$n$$$.
The third line of each testcase contains a binary string $$$b$$$ of length $$$n$$$.
For each test case, print a single integer — the number of different binary matrices modulo $$$10^{9}+7$$$.
5200112011130011113010110400000101
2 3 49 0 225
In the first test case, all possible matrices are:
| 0 | 1 |
| 1 | 0 |
| 1 | 0 |
| 0 | 1 |
In the second test case, all possible matrices are:
| 0 | 0 |
| 1 | 1 |
| 0 | 1 |
| 1 | 1 |
| 1 | 0 |
| 1 | 1 |
| Name |
|---|


