#t310. Pell 数列
Pell 数列
Background
Special for beginners, ^_^
Pell Sequence
Problem Description
The Pell sequence is defined as $a_1 = 1, a_2 = 2, \dots, a_n = 2a_{n-1} + a_{n-2}\ (n > 2)$.
Given a positive integer , output the -th term of the Pell sequence modulo .
Input Format
The st line is the number of test cases (), followed by lines of input. Each test case occupies line and contains one positive integer ().
Output Format
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.