Poj_3734
This topic is 《ProgramAn example in the Integrated Mathematics in design. For an even number, this item can be written as (exp (x) + exp (-x)/2, if there is no requirement, you can write it as exp (x). By multiplying the four items, you can generate the function g (x) = (exp (4 * x) + 2 * exp (2 * X) + 1)/4, so x ^ N/(n !) The coefficient is (4 ^ n + 2*2 ^ N)/4, that is (2 ^ (n-1) + 1) * 2 ^ (n-1 ), then, use the Fast Power modulo to obtain the result.
# Include <stdio. h>
# Include < String . H>
# Define D 10007
Int Pow_mod ( Int N)
{
Int Ans;
If (N = 1 )
Return 2 ;
Ans = pow_mod (N/ 2 );
Ans = ans * ans % d;
If (N & 1 )
Ans = ans * 2 % D;
Return Ans;
}
Void Solve ()
{
Int I, j, k, n, ans;
Scanf ( " % D " , & N );
Ans = 1 ;
-- N;
If (N)
Ans = pow_mod (N );
Ans = (ANS + 1 ) * Ans % d;
Printf ( " % D \ n " , ANS );
}
Int Main ()
{
Int T;
Scanf ( " % D " , & T );
While (T --)
{
Solve ();
}
Return 0 ;
}