#P7743. [2019年杭电多校]Rikka with Geometric Sequence
[2019年杭电多校]Rikka with Geometric Sequence
Rikka with Geometric Sequence
Problem Description
A long time ago, Rikka was not good at math. Worrying about Rikka's grades, Yuta sets many interesting math problems for Rikka to help her improve her skills. Now, as Rikka makes more and more progress on math, more and more she feels the joy of solving math tasks. Today, Yuta is quite busy and has no time to seek for new problems for Rikka. Therefore, for the first time, Rikka tries to come up with a problem herself. Setting a problem is just like building blocks. The first step is to choose the bricks. Rikka selects the concepts of "geometric sequence" and "subsequence": Sequence is a geometric sequence if and only if for each index , the values in the sequence holds . Sequnce is a subsequence of if and only if there exists an index sequence which satisfies for each and for each . The second step is to combine the bricks. It is quite simple for Rikka: she soon finds an interesting problem: Given a positive integer , count the number of different geometric subsequences of . The last step, and also the most important step, is to solve the problem. However, this task seems to be too difficult for Rikka. Therefore she seeks for help from you: Could you please help her solve this interesting math problem?
Input
The first line of the input contains a single integer . For each test case, the input contains a single line with a single integer . The input guarantees that there are no more than test cases with .
Output
For each test case, output a single line with a single integer, the answer. The answer can be very large, you only need to print the answer modulo . Hint When , the valid subsequences are $\{1\},\{2\},\{3\},\{4\},\{1,2\},\{1,3\},\{1,4\},\{2,3\},\{2,4\},\{3,4\},\{1,2,4\}$. Therefore the answer is .
Sample Input
10
1
2
3
4
5
6
7
8
9
100
Sample Output
1
3
6
11
16
22
29
39
50
5187
Source
2019 Multi-University Training Contest 9