Limits 1s, 512 MB

Let's define F(N)F(N) as following:

F(N)=(N0)(N1)(N2)(NN)F(N) = \binom{N}{0} \oplus \binom{N}{1} \oplus \binom{N}{2} \oplus \cdots \oplus \binom{N}{N}

You are given an integer N(0N105)N (0 \leq N \leq 10^5), you have to find the remainder when F(N)F(N) is divided by 109+710^9 + 7. More formally, you have to find the value of F(N)mod(109+7)F(N) \mod{(10^9 + 7)}

Definitions:

(Nk) \binom{N}{k} means how many ways can you choose kk elements from NN different elements when order doesn't matter.

Examples:

(00)=1\binom{0}{0} = 1

(52)=10\binom{5}{2} = 10

(43)=4\binom{4}{3} = 4

(54)=5\binom{5}{4} = 5

(55)=1\binom{5}{5} = 1

\oplus is the XOR (Exclusive-OR) operator. XOR outputs 1 when the two input bits are different. The truth table for XOR:

Example:

43=74 \oplus 3 = 7

32=13 \oplus 2 = 1

33=03 \oplus 3 = 0

Input

The first line of the input will contain a single integer TT (1T1041 \leq T \leq 10^4) denoting the number of test cases. On the next T T lines, there will be a single integer NN (0N1050 \leq N \leq 10^5).

Output

For each test case, print the answer in a single line.

Sample

InputOutput
2
2
4
2
6

Submit

Login to submit.

Statistics

74% Solution Ratio
NirjhorEarliest, Dec '18
Sarwar.445674Fastest, 0.0s
pathanLightest, 918 kB
steinumShortest, 500B
Toph uses cookies. By continuing you agree to our Cookie Policy.