Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
ADADIG - Ada and Digits |
As you might already know, Ada the Ladybug is a farmer and she also loves math. One day, as farming is sometimes very laborious work, she was thinking about numbers. She was wondering about how many numbers there are having exactly same digital sum as digital product.
She have found out some answers for small N (sum & product), but then the numbers started getting big. Can you help her to find out the answers for bigger sums to satisfy her mind?
Input
The first line contains a single integer 1 ≤ T ≤ 100, number of test-cases.
Each of the next line contains a single number 1 ≤ N ≤ 3×105, the required sum (and so the required product).
Output
For each test-case, print the number of existing numbers. Since this number might be pretty huge, output it modulo 109+7 (1000000007).
Example Input
8 1 2 3 7 8 12 16 144
Example Output
1 1 1 1 23 240 1091 243368058
Adicionado por: | Morass |
Data: | 2017-09-15 |
Tempo limite: | 0.5s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |