6855.Fibonacci Numbers

Time Limit: 1s Memory Limit: 512MB

The Fibonacci numbers can be defined as follows:

  • $F_0=0$
  • $F_1=1$
  • $F_n = F_{n-2}+F_{n-1}$

Your task is to calculate the value of $F_n$ for a given $n$ .

Input Format(From the terminal/stdin)

The only input line has an integer $n$ .

  • $0 \le n \le 10^{18}$

Output Format(To the terminal/stdout)

Print the value of $F_n$ modulo $10^9+7$ .

Sample Input

Copy
10
  \n

Sample Output

Copy
55
  \n
Source: CSES, Mathematics, 1722

Submit

请先 登录

© 2025 FAQs