Fibonacci Lucky Numbers

시간 제한2초메모리 제한1024 MB

요약
각 n에 대해 지수가 7^(7^(7^n))인 피보나치 수의 마지막 10자리를 구한다.
난이도

보통10점 중 7점

유형
정수론, 수학, 분할 정복
정답자
아직 제출이 없습니다

문제

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 77, 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 nn and the power of sevens: 777n7^{7^{7^n}}. 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 1010 digits of the F_777nF\_{7^{7^{7^n}}}, the 777n7^{7^{7^n}}-th Fibonacci number.

입력

The frst line contains an integer tt indicating the number of test cases. Each of the following tt lines is a test case and contains exactly one positive integer nn.

출력

For each test case, output one line contains the last 1010 digits of F_777nF\_{7^{7^{7^n}}}.

제한

  • 1≤t≤201 ≤ t ≤ 20
  • 1≤n≤1091 ≤ n ≤ 10^9

힌트

The Fibonacci sequence is defined as:

  • F_0=0F\_0 = 0
  • F_1=1F\_1 = 1
  • F_k=F_k−1+F_k−2F\_k = F\_{k-1} + F\_{k-2} for k≥2k ≥ 2

예제1

  1. 예제 1

    입력
    5
    1
    2
    3
    4
    5
    
    예상 출력
    1353646637
    3172443437
    2364206637
    9010523437
    9481646637