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

Array Challenge

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 153428/153428 K (Java/Others)
Total Submission(s): 1065    Accepted Submission(s): 576


Problem Description
There¡¯s an array that is generated by following rule.
$h_0=2,h_1=3,h_2=6,h_n=4h_{n-1}+17h_{n-2}-12h_{n-3}-16$
And let us define two arrays ${b_n} and {a_n}$ as below.
$b_n=3h_{n+1} h_n+9h_{n+1} h_{n-1}+9h_n^2+27h_n h_{n-1}-18h_{n+1}-126h_n-81h_{n-1}+192(n>0)$
$a_n=b_n+4^n$
Now, you have to print $\left \lfloor ¡̀(a_n ) \right \rfloor $ , n>1.
Your answer could be very large so print the answer modular 1000000007.
 

Input
The first line of input contains T (1 <= T <= 1000) , the number of test cases.
Each test case contains one integer n (1 < n <= $10^{15}$) in one line.
 

Output
For each test case print &#8970;¡̀(a_n )&#8971; modular 1000000007.
 

Sample Input
3 4 7 9
 

Sample Output
1255 324725 13185773
 

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-05-17 10:31:20, Gzip enabled