


The first line contains 'T', denoting the number of test cases.
For each Test :
The first line contains a single integer ‘N’, denoting the number of columns on the platform.
For each test, print an integer, denoting the number of valid ways to place the Lego blocks modulo (10^9 + 7).
You are not required to print the expected output. It has already been taken care of. Just implement the function.
1 <= T <= 10
1 <= N <= 10^5
The sum of 'N' all test cases does not exceed 10^5.
Time Limit: 1 sec
We try each of these 6 configurations until we either exceed the boundary of the platform, or get one valid placing. We can recursively count the number of such placings.
Algorithm:
Now, we need to compute two things for each ‘i’ :
F[i] = Number of valid placings such that ‘i’ columns are fully covered
P[i] = Number of valid placings such that ‘i’th column is partially covered
At the ‘i’th column, to make it fully filled,we can place blocks like this:
Therefore:
F[i] = F[i-1] + F[i-2] + (2*P[i-1])
At the ‘i’th column, to make it partially filled,we can place blocks like this:
Therefore:
P[i] = P[i-1] + F[i-2]
Algorithm: