atcoder#ABC228E. [ABC228E] Integer Sequence Fair
[ABC228E] Integer Sequence Fair
Score : points
Problem Statement
Integer Sequence Exhibition is taking place, where integer sequences are gathered in one place and evaluated. Here, every integer sequence of length consisting of integers between and (inclusive) is evaluated and given an integer score between and (inclusive).
Print the number, modulo , of ways to give each of the evaluated sequences a score between and .
Here, two ways are said to be different when there is an evaluated sequence that is given different scores by the two ways.
Constraints
- , , and are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number, modulo , of ways to give each of the evaluated sequences a score between and .
2 2 2
16
Four sequences are evaluated: , , , and . There are ways to give each of these sequences a score between and , as follows.
- Give to , to , to , and to
- Give to , to , to , and to
- Give to , to , to , and to
- Give to , to , to , and to
- Give to , to , to , and to
Thus, we print .
3 14 15926535
109718301
Be sure to print the count modulo .