luogu#P4451. [国家集训队] 整数的lqp拆分
[国家集训队] 整数的lqp拆分
Background
Source: 2011 China CTT Problem Defense.
Problem Description
lqp is struggling to write problems and has no clue, which is frustrating.
He first thought of integer decompositions. Integer decomposition is an interesting problem. Given a positive integer , an integer decomposition of is an ordered sequence such that for any , , and . After long study, we found a very simple recurrence to count the total number of integer decompositions of , but because that recurrence is too simple, if he gave such a problem, nobody would be interested.
Then lqp thought of Fibonacci numbers. Define ; is the -th Fibonacci number. But computing the -th Fibonacci number does not seem very hard either.
To make the contest more appealing, lqp racked his brain and came up with an interesting integer decomposition; let us call it: the lqp decomposition of an integer.
Like ordinary integer decompositions, an lqp decomposition of an integer is an ordered sequence with , , and . However, instead of asking for the total number of decompositions, the lqp decomposition asks for something a bit harder.
For each decomposition, lqp defines its weight as . He wants to know the sum of the weights over all decompositions.
In short, compute
$$\sum_{\substack{m>0\\a_1,\cdots,a_m>0\\a_1+\cdots+a_m=n}}\prod_{i=1}^mF_{a_i}$$Since the answer can be very large, output it modulo .
Input Format
The first line of input contains an integer .
Output Format
Output one line with a single integer representing the answer.
3
5
Hint
Constraints:
For of the testdata, .
For of the testdata, .
Sample explanation:
.
For , there are the following lqp decompositions:
, the weight is .
, the weight is .
, the weight is .
, the weight is .
Therefore, the answer is .
Translated by ChatGPT 5