#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 aa, what is the value of the aa-th Fibonacci number modulo 10001000?

Input Format

The first line contains nn, the number of test cases, followed by nn lines of input. Each test case occupies one line and contains a positive integer a(1≤a≤1000000)a (1 \le a \le 1000000).

Output Format

Output nn lines, each corresponding to one input. Each line should contain a positive integer — the aa-th Fibonacci number modulo 10001000.

Sample Input

4
5
2
19
1

Sample Output

5
1
181
1

Constraints

1 second, 1024 KiB for each test case.