Fibonacci Sum
Submissions: 3863   Accuracy:

17.32%

  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, …

Input  : n = 3
Output : 4
Explanation : 0 + 1 + 1 + 2  = 4

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

Since the answer can be very large, answer modulo 1000000007 should be printed.

Input:
First line contains an integer, the number of test cases 'T' Each test case should contain a positive integer N.


Output:
Print sum of fibonacci numbers.


Constraints:
1 <=T<= 20000
1 <= N <=100000


Example:
Input:
2
6
5

Output:
20
12

** 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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.