Fibonacci Sequence (Harder)

View as PDF

Submit solution

Points: 17
Time limit: 0.3s
Memory limit: 64M

Author:
Problem type

quantum is not feeling well today, and has decided to create a more painful version of the simple Fibonacci problem.

Recall that the Fibonacci sequence is a well known sequence of numbers in which

F(n)={0,if n=01,if n=1F(n2)+F(n1),if n2

You are given a number N (1N10100000), find the Nth Fibonacci number, modulo 1000000007 (=109+7).

Input Specification

The first line of input will have the number N.

Output Specification

The Nth Fibonacci number, modulo 1000000007 (=109+7).

Sample Input

Copy
26

Sample Output

Copy
121393

Comments

There are no comments at the moment.