Semi-equations

4.2

5 votes
Linear Algebra, Algorithms, Matrix Exponentiation, Math
Problem

You are given t test cases. Each test case contains an integer n. Find the value of the following function:

 

such that 

  • f[0]=0,f[1]=1,f[2]=1,....,f[n]=f[n1]+f[n2].

Formally, you are required to find the summation from i=0 to i=n for f[i].

Input format

  • The first line contains an integer t denoting the number of test cases.
  • Each of the next t lines contains an integer n.

Output format

Print the answer as described above modulo 109+7.

Constraints

1t105

1n1018

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

In the first test case we have n=1 so we have to find the summation of f[0]+f[1] = 0+1 = 1,

also the second test case the answer will be 0+1+1+2+3+5+8+13 = 33.

Editor Image

?