#P4451. [国家集训队] 整数的lqp拆分

    ID: 3383 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>递推斐波那契,Fibonacci生成函数线性递推,递推式

[国家集训队] 整数的lqp拆分

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 nn, an integer decomposition of nn is an ordered sequence such that for any m>0m>0, a1,a2,a3,,am>0a_1,a_2,a_3,\cdots,a_m>0, and a1+a2+a3++am=na_1+a_2+a_3+\cdots+a_m=n. After long study, we found a very simple recurrence to count the total number of integer decompositions of nn, but because that recurrence is too simple, if he gave such a problem, nobody would be interested.

Then lqp thought of Fibonacci numbers. Define F0=0,F1=1,Fn=Fn1+Fn2(n>1)F_0=0,F_1=1,F_n=F_{n-1}+F_{n-2}(n>1); FnF_n is the nn-th Fibonacci number. But computing the nn-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 m>0m>0, a1,a2,a3,,am>0a_1,a_2,a_3,\cdots,a_m>0, and a1+a2+a3++am=na_1+a_2+a_3+\cdots+a_m=n. 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 Fa1Fa2FamF_{a_1}F_{a_2}\cdots F_{a_m}. 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 109+710^9 + 7.

Input Format

The first line of input contains an integer nn.

Output Format

Output one line with a single integer representing the answer.

3
5

Hint

Constraints:
For 60%60\% of the testdata, 1n1091 \le n \le 10^9.
For 100%100\% of the testdata, 1n10100001 \le n \le 10^{10000}.

Sample explanation:
F0=0,F1=1,F2=1,F3=2F_0=0,F_1=1,F_2=1,F_3=2.

For n=3n=3, there are the following lqp decompositions:

3=1+1+13=1+1+1, the weight is F1×F1×F1=1×1×1=1F_1\times F_1\times F_1=1\times1\times1=1.

3=1+23=1+2, the weight is F1×F2=1×1=1F_1\times F_2=1\times1=1.

3=2+13=2+1, the weight is F2×F1=1×1=1F_2\times F_1=1\times1=1.

3=33=3, the weight is F3=2F_3=2.

Therefore, the answer is 1+1+1+2=51+1+1+2=5.

Translated by ChatGPT 5