Rohan's Love for Matrix
Submissions: 3031   Accuracy:

14.19%

  Difficulty: Hard   Marks: 8

Rohan has a special love for the matrices especially for the first element of the matrix. Being good at Mathematics, he also loves to solve the different problem on the matrices. So one day he started to multiply the matrix with the original matrix.  The elements of the original matrix are given by

a00=1 , a01=1, a10=1, a11=0.

Given the power of the matrix, n calculate the an and print the a10 element mod 1000000007.

Input:

The first line contains an integer T denoting the no of test cases. Then T test cases follow.Each test case contains an integer, n.
 

Output:

Print the first element of the matrix i.e. a10.

Constraints:
1<=T<=100
1<=n<=1012

Example:
Input:
2
3
8

Output:
2
21

Explanation:
Take the cube of the original matrix i.e a3 and print the first element(a10) which comes out to be 2.
Similarly, for the second case, the first element(a10) of a8 is 21.

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

Contributor: vaibhav garg
Author: justrelax


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.