6735.Counting Towers

Time Limit: 1s Memory Limit: 512MB

Your task is to build a tower whose width is $2$ and height is $n$ . You have an unlimited supply of blocks whose width and height are integers.

For example, here are some possible solutions for $n=6$ :

2413-1.png

Given $n$ , how many different towers can you build? Mirrored and rotated towers are counted separately if they look different.

Input Format(From the terminal/stdin)

The first input line contains an integer $t$ : the number of tests.

After this, there are $t$ lines, and each line contains an integer $n$ : the height of the tower.

  • $1 \le t \le 100$
  • $1 \le n \le 10^6$

Output Format(To the terminal/stdout)

For each test, print the number of towers modulo $10^9+7$ .

Sample Input

Copy
3
2
6
1337
 \n
 \n
 \n
    \n

Sample Output

Copy
8
2864
640403945
 \n
    \n
         \n
Source: CSES, Dynamic Programming, 2413

Submit

请先 登录

© 2025 FAQs