 Timer is Running

Fibonacci Sum
##### Submissions: 43   Accuracy: 23.24%   Difficulty: Easy   Marks: 2

Given a number positive number N, find value of f0 + f1 + f2 + …. + fN where fi indicates i’th Fibonacci number.
Remember that f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, …
Since the answer can be very large, answer modulo 1000000007 should be returned.

Example 1:

```Input:
N = 3
Output:
4
Explanation:
0 + 1 + 1 + 2  = 4
```

Example 2:

```Input :
N = 4
Output :
7
Explanation :
0 + 1 + 1 + 2 + 3 = 7
```

You don't need to read input or print anything. Your task is to complete the function fibSum() which takes an integer N as input parameter and returns the sum of all the Fibonacci number from F0 to FN.

Expected Time Complexity: O(Log N)
Expected Space Complexity: O(1)

Constraints:
1 <= N <= 100000

#### ** For More Input/Output Examples Use 'Expected Output' option **

Author: kartik

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.