Anti-hash Test

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

It is well-known that the following string s(n)=s_0s_1s_2n1s(n) = s\_0 s\_1 \ldots s\_{2^n-1} can challenge almost every solution that uses polynomial hashes modulo 2642^{64}

s\_i = \begin{cases} \text{\`\`a''}, & \mathrm{popcount}(i) \bmod 2 = 0 \\\ \text{\`\`b''}, & \mathrm{popcount}(i) \bmod 2 = 1 \end{cases} where popcount(i)\mathrm{popcount}(i) means the number of ones in binary representation of number ii.

Given a string uu and an integer nn, find the number of occurrences of uu in string s(n)s(n) and the number of distinct strings vv which have the same number of occurrences in string s(n)s(n). As both the numbers may be very large, you are only asked to calculate them modulo 109+710^9 + 7.

입력

There are multiple test cases. The first line of input contains an integer TT, indicating the number of test cases. For each test case:

The first line contains an integer nn (1n10181 \le n \le 10^{18}).

The second line contains a string uu (1umin(106,2n)1 \le |u| \le \min(10^6, 2^n)) consisting only of letters "a" and "b".

It is guaranteed that the sum of u|u| over all test cases does not exceed 10610^6.

출력

For each test case, if the string uu does not appear in string s(n)s(n), you should simply output 1-1. Otherwise, output two integers denoting the the number of occurrences of uu in string s(n)s(n) modulo 109+710^9 + 7 and the number of distinct strings vv which have the same number of occurrences in string s(n)s(n) modulo 109+710^9 + 7.