Welcome to Massey CS Club 2015/16!
To start things off, a new head data slave needs to be hired (the old one has been promoted).
The new head data slave must not only be fast at copying data, but also decent with math calculations or simply bashing numbers. Luckily for most people, the head data slave exam only consists of 1 question. Solve this question for bonus (Komachi) points.
Question
In the massive multiplayer online role-playing game Elder Tale, the humans are at war with monsters. Shiroe, the strategist of the legendary Debauchery Tea Party is in charge of organizing
Input Specification
The first line of input will have one integer
The following
Output Specification
Print the number of ways Shiroe can order his armies modulo
Sample Input 1
3
2
2
1
Sample Output 1
3
Explanation
The 3 ways are:
1 1 2 2 3
1 2 1 2 3
2 1 1 2 3
Ah, that scored high Komachi points!
Sample Input 2
5
4
1
2
3
1
Sample Output 2
216
Comments
Leo I like Log Horizon and everything, but I don't get the input specifications. What are those integers supposed to mean????
The given input is : 3 2 2 1
Which is interpreted as:
First line: There are 3 types of militants
Second line: There are 2 militants of type 1
Third line: There are 2 militants of type 2
Fourth line: There are 2 militants of type 3
For example, 1 1 2 2 3 is a valid case for this input