#t309. 斐波纳契数列
斐波纳契数列
Fibonacci Sequence
Problem Background
Special for beginners, ^_^
Problem Description
The Fibonacci sequence is defined as follows: the first and second numbers are both 1, and each subsequent number equals the sum of the preceding two numbers.
Given a positive integer , what is the value of the -th Fibonacci number modulo ?
Input Format
The first line contains , the number of test cases, followed by lines of input. Each test case occupies one line and contains a positive integer .
Output Format
Output lines, each corresponding to one input. Each line should contain a positive integer — the -th Fibonacci number modulo .
Sample Input
4
5
2
19
1
Sample Output
5
1
181
1
Constraints
1 second, 1024 KiB for each test case.