#t310. Pell 数列

Pell 数列

Background

Special for beginners, ^_^

Pell Sequence

Problem Description

The Pell sequence a1,a2,a3,…a_1, a_2, a_3, \dots is defined as $a_1 = 1, a_2 = 2, \dots, a_n = 2a_{n-1} + a_{n-2}\ (n > 2)$.

Given a positive integer kk, output the kk-th term of the Pell sequence modulo 3276732767.

Input Format

The 11st line is the number of test cases nn (1≤n≤1001 \le n \le 100), followed by nn lines of input. Each test case occupies 11 line and contains one positive integer kk (1≤k<10000001 \le k < 1000000).

Output Format

nn lines, each line corresponding to one input. Each line should contain a non-negative integer.

Sample Input

2
1
8

Sample Output

1
408

Constraints

1s, 1024KiB for each test case.