Problem B
The Deal of the Day
A bored technician whose job requires inspecting each of
As time goes by, he adds cards for the number of stations where he finds problems, so that he will visit them more often, so the number of cards bearing each digit may vary considerably.
One day he deals out his cards, and notices that they have come out in strictly ascending order. He starts to wonder just how likely such an ordering would be.
Find the number of ways to deal the cards that form a
strictly ascending sequence. (“Strictly ascending” in this
problem means that, for example
Input
The first line of input contains
This is followed by a line containing an integer
Output
Print a single line containing an integer denoting the
number of ways to deal
Sample Input 1 | Sample Output 1 |
---|---|
4 0 0 0 4 0 0 0 0 4 3 |
64 |
Sample Input 2 | Sample Output 2 |
---|---|
4 0 0 0 4 0 0 0 0 4 4 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
10 10 10 20 0 10 10 10 10 10 4 |
1820000 |
Sample Input 4 | Sample Output 4 |
---|---|
100 100 100 100 100 100 100 100 100 100 10 |
100000000000000000000 |