Cubist Painting

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

요약
색칠된 정육면체를 굴려 어떤 칸도 다른 색으로 다시 칠하지 않으면서 2×n 격자를 완성하는 서로 다른 그림의 수를 센다.
난이도

어려움10점 중 9점

유형
조합론, 동적 계획법, 행렬
정답자
아직 제출이 없습니다

문제

This problem has an interactive web tool that lets you test the painting process for yourself!

You have a canvas that is represented as a 22 by nn grid, and a cube with the same side length as the squares in the canvas. You want to paint the canvas using the cube, so you begin by painting each of the faces of the cube in a different color, as shown here:

Note that this coloring is fixed, so for example, the red face must always be opposite the blue face, etc.

You will paint the canvas by first placing the cube, with any face of your choice facing down, on any square of the canvas. You can then repeatedly "roll" the cube along any of the edges currently touching the canvas. Any time a face of the cube touches a square of the canvas, that square is painted the same color as the face. For example, here is one possible sequence of 55 moves you could make:

After this sequence of moves, the canvas would look like this:

If two colors mix, the resulting color is very ugly, so you don't want to use it in your painting. Therefore, once you've painted a square, you aren't allowed to move the cube in a way that would paint that square again in a different color. Note that painting a square the same color multiple times is fine, as shown by the red square in the example above.

You want to make the canvas as colorful as possible, so you don't want any white squares to remain once the painting is done.

Under these restrictions, how many distinct paintings are possible? Two paintings are considered distinct if there exists a square on the canvas that is painted in different colors in each. Since the answer may be large, print it modulo 109+710^9+7.

A web tool is available that lets you move the cube around and paint the canvas.

입력

The first line of the input contains a single integer tt (1≤t≤10001 \le t \le 1000) --- the number of test cases. The description of the test cases follows.

Each test case consists of a single line containing one integer nn (1≤n≤10181 \le n \le 10^{18}) --- the number of columns in the canvas.

출력

For each test case, output a single integer --- the number of distinct paintings on a 22 by nn canvas, modulo 109+710^9+7.

힌트

Here are the 2424 possible paintings for the first sample case:

예제1

  1. 예제 1

    입력
    7
    1
    2
    3
    4
    5
    1000
    1000000000000000000
    
    예상 출력
    24
    96
    312
    1056
    3408
    152353512
    86193561