You're given a digital string of length , You're asked to evaluate f_1,f_2,f_3,...,f_n.
where
where denotes the set of distinct permutations.
and the bold color of \mathbf{s_i} means s_i is fixed and cannot be moved from index .
Since each of f_1,f_2,...,f_n may be incredibly large , print each modulo 10^9+7.
The first line contains single integer (1 \le t \le 10^4) — the number of test cases.
The only line of test case contains single digital string (1 \le |s| \le 10^6) — the digital string.
It's guaranteed that \sum s \le 10^6 overall tests.
For each test case , print integers f_1,f_2,...,f_n.
Example 1
For the first test case:
For i=1 the distinct permutations are :
which gives f_1=101+110=211.
For i=2 the distinct permutations are :
which gives f_2=101
For i=3 the distinct permutations are :
which gives f_3=101+11=112
Subtask ( points) : (t=1; |s| \le 6)
Subtask ( points) : (s_1=s_2=s_3=..=s_{|s|})
Subtask ( points) : (s_i \neq s_j) for (i \neq j)
Subtask ( points) : (1 \le \sum |s| \le 1000)
Subtask ( points): No additional constraints.