Input
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
The first line of each test case contains a string of digits S.
It is guaranteed that S will occur satisfying the given condition somewhere in D.
Output
For each test case, output a single line containing the minimal position number where S occurs in D under the given condition, modulo 109+7. Consider the string to be 1-indexed: '1' is in position 1.