#arc145f. [arc145_f]Modulo Sum of Increasing Sequences
[arc145_f]Modulo Sum of Increasing Sequences
Problem Statement
Find the number, modulo , of non-decreasing sequences of length consisting of integers between and (inclusive) that satisfy the following, for each :
- the sum of the elements in is congruent to modulo .
What is a non-decreasing sequence? A sequence is non-decreasing if and only if for every integer (), where is the length of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
For each , print the number, modulo , of sequences that satisfy the condition.
Sample Input 1
2 2 4
Sample Output 1
2 1 2 1
There are non-decreasing sequences of length consisting of integers between and : . Here, we have:
-
sequences whose sums are congruent to modulo : ;
-
sequence whose sum is congruent to modulo : ;
-
sequences whose sums are congruent to modulo : ;
-
sequence whose sum is congruent to modulo : .
Sample Input 2
3 45 3
Sample Output 2
5776 5760 5760
Sample Input 3
1000000 1000000 6
Sample Output 3
340418986 783857865 191848859 783857865 340418986 635287738
Print the counts modulo .