F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

CCPC Strings

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 480    Accepted Submission(s): 229


Problem Description
A string whose each character is either `C` or `P` is called a *CP-String*, so there are $2^N$ different *CP-Strings* of length $N$. We define the *CCPCness* of a *CP-String* as the number of the most non-overlapping `CCPC` as its substrings.

For example, the *CCPCness* of `CCPCCCPC` is $2$, but the *CCPCness* of `CCPCCPC` is $1$ because the chosen `CCPC` substrings can not overlaps.

You are given an integer $N$, and you need to calculate the sum of *CCPCness* of all the $2^N$ different *CP-Strings* of length $N$. The answer may be too large, so you just need to output it modulo $(10^9+7)$.
 

Input
The first line of input contains an integer $T$ ($1\leq T\leq 10^5$), denoting the number of test cases.

For each test case, there is one line with one integer $N$ ($1\leq N\leq 10^9$).
 

Output
For each test case, print one integer in one line, denoting your answer modulo $(10^9+7)$.
 

Sample Input
7 3 4 5 6 7 10 123456789
 

Sample Output
0 1 4 12 31 417 11557040
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 05:31:39, Gzip enabled