2016-17 Woburn Challenge Finals Round - Senior Division
The worst has come to pass, with the war between the monkeys and cows now officially in full swing. In fact, the first major battle has been scheduled for next week! As an experienced military leader, the Head Monkey is well aware of the importance of an often under-appreciated aspect of war – the nutritional well-being of the soldiers. She's taken it upon herself to personally prepare the upcoming battle's rations.
The Head Monkey has
The Head Monkey intends to come up with a smoothie recipe, which will
call for combining a certain set of fruits together to create a single
smoothie. The recipe
It's also unclear how many monkeys will actually be participating in the upcoming battle, though the number of monkeys will surely be some positive integer. However, it's imperative that each of them receive a single smoothie, with all of the smoothies having been created using the same recipe as one another.
Of course, the number of available fruits is a serious limiting factor.
If there are
The Head Monkey has lots of great recipes in mind, but she's willing to
accept that some of them might not work out in terms of producing a
valid set of smoothies for
As a hint, the following properties of modular arithmetic may be useful:
In test cases worth
In test cases worth another
In test cases worth another
Input Specification
The first line of input consists of a single integer
The second line of input consists of
Output Specification
Output one line consisting of a single integer – the number of different
possible recipes which might be used (modulo
Sample Input
3
4 2 4
Sample Output
10
Sample Explanation
(serving monkey) (serving monkey) (serving monkeys)
There are
Comments