luogu#P3986. 斐波那契数列

    ID: 2937 远端评测题 1000ms 500MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>数学递归枚举不定方程Fibonacci 数列洛谷月赛

斐波那契数列

Problem Description

Define a sequence:

f(0)=a,f(1)=b,f(n)=f(n1)+f(n2)f(0) = a, f(1) = b, f(n) = f(n - 1) + f(n - 2)

where a,ba, b are positive integers and n2n \geq 2.

How many pairs (a,b)(a, b) are there such that kk appears in this sequence and is not one of the first two terms?

Since the answer may be large, you only need to output the result modulo 109+710^9 + 7.

Input Format

One line containing an integer kk.

Output Format

One line containing an integer, which is the answer modulo 109+710^9 + 7.

19260817
34166325
1000000000
773877569

Hint

1k1091 \leq k \leq 10^9.

Translated by ChatGPT 5