atcoder#ARC156B. [ARC156B] Mex on Blackboard
[ARC156B] Mex on Blackboard
Score : points
Problem Statement
For a finite multiset of non-negative integers, let us define as the smallest non-negative integer not in . For instance, $\mathrm{mex}(\lbrace 0,0, 1,3\rbrace ) = 2, \mathrm{mex}(\lbrace 1 \rbrace) = 0, \mathrm{mex}(\lbrace \rbrace) = 0$.
There are non-negative integers on a blackboard. The -th integer is .
You will perform the following operation exactly times.
- Choose zero or more integers on the blackboard. Let be the multiset of chosen integers, and write on the blackboard once.
How many multisets can be the multiset of integers on the final blackboard? Find this count modulo .
Constraints
- All numbers in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
3 1
0 1 3
3
The following three multisets can be obtained by the operations.
For instance, you can get by choosing the on the blackboard to let in the operation.
2 1
0 0
2
The following two multisets can be obtained by the operations.
Note that you may choose zero integers in the operation.
5 10
3 1 4 1 5
7109