Fibonacci Sequence
Time limit2sMemory limit512 MB
For up to 1000 queries, compute the x-th Fibonacci number modulo 10^9, where x can be as large as 2^48.
- Level
Medium7 of 10
- Topics
- Math, Matrix, Divide and conquer, Number theory
- Solved
- No attempts yet
Problem
Read an integer and compute modulo , where is the -th value of the Fibonacci sequence.
The Fibonacci sequence is defined as follows.
Input
The first line contains the number of test cases ().
Each of the next lines contains one integer ().
Output
For each test case, print modulo on its own line.