atcoder#ABC225H. [ABC225H] Social Distance 2
[ABC225H] Social Distance 2
Score : points
Problem Statement
There are chairs arranged in a row, called Chair , Chair , , Chair . A chair seats only one person.
people will sit on of these chairs. Here, let us define the score as follows:
, where is the sorted list of the indices of the chairs the people sit on.
Person is already sitting on Chair . There are ways for the other people to take seats. Find the sum of the scores for all of these ways.
Since this sum may be enormous, compute it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
5 3 2
1 3
7
If Person sits on Chair , the score will be . If Person sits on Chair , the score will be . If Person sits on Chair , the score will be . The answer is .
6 6 1
4
120
The score for every way of sitting will be . There are ways of sitting, so the answer is .
99 10 3
10 50 90
761621047