#P15910. [TOPC 2024] Fibonacci Lucky Numbers
[TOPC 2024] Fibonacci Lucky Numbers
Description
Welcome to the Lucky 777 Slot Game! This game is known for its complex mathematical challenges, where only the smartest can win the jackpot.
The slot machine is powered by a mysterious sequence—the Fibonacci sequence. But it’s no ordinary Fibonacci sequence; it has a twist inspired by the number , the symbol of luck in slot games.
When you pull the lever of the Lucky 777 Slot Machine, it generates a gigantic number using an integer and the power of sevens: . This number, however, is so massive that even the most powerful computers cannot handle it directly.
To claim the jackpot, you need to compute the last digits of the , the -th Fibonacci number.
Note
The Fibonacci sequence is defined as:
- for
Input Format
The first line contains an integer indicating the number of test cases. Each of the following lines is a test case and contains exactly one positive integer .
Output Format
For each test case, output one line containing the last digits of .
5
1
2
3
4
5
1353646637
3172443437
2364206637
9010523437
9481646637
京公网安备 11011102002149号