The Fibonacci sequence is F(0)=0, F(1)=1, and F(k)=F(k-1)+F(k-2) for k>=2. Because the numbers grow quickly, output F(n) modulo 1000000007.
One line: a non-negative integer n.
One line: F(n) mod 1000000007.
Example 1
Input
10
Expected
55
Explanation
F(10) = 55, and 55 mod 1000000007 is 55.
Example 2
Input
0
Expected
0
Explanation
F(0) is defined as 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →