All Tracks Math Number Theory Basic Number Theory-1 Problem

The Easy One!
/

Math

Problem
Editorial
Analytics

Bob is given a big number N. Now, Bob wants to know how many different numbers are possible by shuffling the digits of N. Since the answer can be very big, print the answer modulo 10^9 + 7.

Input Format

First line contains T (the number of Test Cases).

Each testcase contains a big number N.

Output Format

For each testcase print the answer in a new line.

Constraints

1≤T≤100

\(1 \le N \le 10^{10^5}\)

Note

The big number N may contain leading 0's.

SAMPLE INPUT
1
21
SAMPLE OUTPUT
2
Explanation

The number 21 can be shuffled to write as- 12 and 21 only. Hence the answer is 2.

Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?