#Lutece1307. ABCDE
ABCDE
Migrated from Lutece 1307 ABCDE
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Binary-coded decimal (BCD) is a kind of binary encodings of decimal numbers where each decimal digit is represented by a fixed number of bits.
Awesome Binary-Coded Decimal (ABCD) is, under the above conditions, any number represented by corresponding binary value won't exceed .
For example, in encoding, is , exceed , so encoding is BCD but not ABCD. In encoding, any number represented by corresponding binary value won't exceed , so encoding is ABCD.
Now, let's talk about ABCDE (Awesome Binary-Coded Decimal Extension).
An n-ABCDE is such a encoding that can only represent to , and every number from to can be represented by one or more binary values. So is a -ABCDE and is a -ABCDE as we mentioned above. In addition, is a -ABCDE.
Two encoding will be considered different if they have different length, or they have different number set, with the number of occurrence of each number considered. More precisely, two different coding will have such a number that occur different times.
So, encoding is the same with the encoding, but it is different from .
Now, given a number , can you tell me how many different -ABCDEs?
Input
There is an integer in the first line, indicates the number of test cases.
For each test, the only line contains a integer .
Output
For each test, output an integer in one line, which is the number of different -ABCDEs. As the answer may be too large, output it modulo (i.e. if the answer is , you should output ).
Samples
5
1
2
3
4
5
1
1
2
2
4
Note
There are four -ABCDEs: , , , .
Resources
The 14th UESTC Programming Contest Final