atcoder#ABC220D. [ABC220D] FG operation
[ABC220D] FG operation
Score : points
Problem Statement
We have a sequence of integers between and (inclusive): , arranged from left to right in this order.
Until the length of the sequence becomes , we will repeatedly do the operation or below.
- Operation : delete the leftmost two values (let us call them and ) and then insert to the left end.
- Operation : delete the leftmost two values (let us call them and ) and then insert to the left end.
Here, denotes the remainder when is divided by .
For each , answer the following question.
Among the possible ways in which we do the operations, how many end up with being the final value of the sequence? Since the answer can be enormous, find it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print ten lines. The -th line should contain the answer for the case .
3
2 7 6
1
0
0
0
2
1
0
0
0
0
If we do Operation first and Operation second: the sequence becomes . If we do Operation first and Operation second: the sequence becomes . If we do Operation first and Operation second: the sequence becomes . If we do Operation first and Operation second: the sequence becomes .
5
0 1 2 3 4
6
0
1
1
4
0
1
1
0
2