Raju and his safes

All submissions for this problem are available.
Raju bought some books from the market and kept them into his group of safes in his room.Tomorrow is his exam and he wants to take out some books from the safes.but his mother who know the passwords of all the safes is not at home and she will come late at night.
Raju has two options left either he should wait for his mother to come home or try to open a group of safes by using his conventional tools, drilling and fiber camera.However, these safes come under a special category where he can’t open a safe without triggering the antitheft alarm. The only way he can gain access to these safes is by knowing their passwords.He know that if he would select the first option then he will definitely fail in tomorrow,s exam.So There is nothing he can do other than waiting for his mother.
Suddenly Raju remembered what his mother taught him about these safes. he remembered that the password to each safe is in the form of a square matrix containing digits from 0 to 9. Each row of the matrix has a prime number. Also, the password matrix is symmetric in nature i.e. Transpose( A)=A.
Now the problem is that Raju only remembers the prime numbers n_{i} in the first line of each safe’s password but he knows that total digits of n_{i} determines the dimension of password matrix for safe i.
Can you help him in finding the total password combinations for each safe???
Each prime number can occur in one than one rows of password matrix or in several matrices. The prime numbers which are not first line prime numbers can start with zeros.
Input
The first line of the input contains an integer t — the number of safes. Next t lines contain integers n_{}, n_{i}is a prime number written in the first row of the password matrix for the ith safe. All n_{i}'sdo not have leading zeros.
Output
Print t numbers, the ith of them should be the number of matrices that can be a password to the ith safe. Print the numbers on separate lines.
Constraints
 1 ≤ t ≤ 30
 1 ≤ n_{i} ≤ 99999
Example
Input: 4 11 239 401 9001 Output: 4 28 61 2834
Author:  sumit_kap 
Tags  sumit_kap 
Date Added:  4032016 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 