#T341. Pell数列
Pell数列
Description
The Pell sequence is defined as follows: , , , (for ). Given a positive integer , find the value of the -th term in the Pell sequence modulo .
Input Format
The first line contains the number of test cases , followed by lines of input. Each test case occupies one line and consists of a positive integer ().
Output Format
Output lines, each corresponding to an input. Each output should be a non-negative integer.
2
1
8
1
408