This page is still under construction.

Parts of this page are still being built. What you see may change.

Last three digits of the integer part

Time limit2sMemory limit512 MB

Summary
For each n up to 2e9, report the last three digits of the integer part of (3+sqrt(5))^n, zero padded to three digits.
Level

Medium7 of 10

Topics
Math, Number theory, Matrix, Divide and conquer
Solved
No attempts yet

Problem

Find the last three digits of the integer part of (3+5)n(3+\sqrt{5})^n.

For example, with n=5n = 5, (3+5)5=3935.73982…(3+\sqrt{5})^5 = 3935.73982\ldots, so the answer is 935.

If the integer part has fewer than three digits, pad it with leading zeros so the answer always has three digits. For example, with n=2n = 2, (3+5)2=27.4164079…(3+\sqrt{5})^2 = 27.4164079\ldots, so the answer is 027.

Input

The first line contains the number of test cases TT (1≤T≤1001 \le T \le 100).

Each of the next TT lines contains one natural number nn (2≤n≤2×1092 \le n \le 2 \times 10^9).

Output

For each test case, print the answer on one line in the form Case #c: x. Here cc is the test case number, counted from 1, and xx is the answer for that test case. Always write xx with three digits.

Examples3

  1. Example 1

    Input
    2
    5
    2
    
    Expected output
    Case #1: 935
    Case #2: 027
    
  2. Example 2

    Input
    1
    2
    
    Expected output
    Case #1: 027
    
  3. Example 3

    Input
    1
    2000000000
    
    Expected output
    Case #1: 751