| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 256 MB | 10 | 5 | 5 | 55.556% |
Chiaki finds the following interesting stone game: two players start with two non-empty piles of stones. In each turn, the player can choose a pile with an even number of stones and move half of the stones of this pile to the other pile. The game ends if a player cannot move, or if we reach a previously reached position. In the first case, the player who cannot move loses. In the second case, the game is declared a draw.
Given two positive integers $n$ and $m,ドル Chiaki would like to know the number of pairs $(a, b)$ (1ドル \le a \le n, 1 \le b \le m)$ such that if initially the two piles have $a$ and $b$ stones respectively, then the first player has a winning strategy, or the game ends with a draw, or the second player has a winning strategy. Since this number may be very large, you are only asked to calculate it modulo 10ドル^9+7$.
There are multiple test cases. The first line of the input contains an integer $T,ドル indicating the number of test cases. For each test case:
The first line contains a binary string $s$ (1ドル \le |s| \le 10^6$) -- the binary representation of $n$ without leading zeros.
The second line contains a binary string $t$ (1ドル \le |t| \le 10^6$) -- the binary representation of $m$ without leading zeros.
It is guaranteed that the sum of the length of binary strings in all test cases will not exceed 2ドル \times 10^6$.
For each test case, output three integers: the number of pairs $(a, b)$ such that first player wins, the game ends with a draw or the second player wins, correspondingly.
3 111 111 1111 1111 10101010 1001010
8 24 17 41 116 68 2546 6689 3345
For the first sample: