Sum of Even-Indexed Fibonacci Numbers
Time limit1sMemory limit256 MB
Given n, add the Fibonacci numbers at even indices from 0 to n and print the sum modulo 1000000007.
Problem
The Fibonacci numbers start with 0 and 1. The 0th Fibonacci number is 0 and the 1st is 1. From index 2 on, each Fibonacci number is the sum of the two before it.
Written as a formula, for .
The Fibonacci numbers up to are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597
Given , compute the sum of the Fibonacci numbers whose index is even, taken over indices 0 through .
Input
The first line contains , a positive integer no larger than .
Output
Print on the first line the sum of the Fibonacci numbers with an even index, over indices 0 through , modulo .