#P1990. 覆盖墙壁

覆盖墙壁

Description

You have a wall of length NN and width 22. You are given two types of bricks: one is 2×12\times 1, and the other is an L-shaped brick that covers 33 unit cells. As shown below:

0  0
0  00

Bricks can be rotated, and both types are available in unlimited quantity. Your task is to count the number of ways to tile the N×2N\times 2 wall using these two types. For example, a 2×32\times3 wall can be tiled in 55 ways, as follows:

012 002 011 001 011  
012 112 022 011 001

Note that the two types can be mixed in a tiling; for example, a 2×42\times4 wall can be tiled as follows:

0112
0012

Given NN, compute the number of tilings for the 2×N2\times N wall. Since the result can be large, output only the last 44 digits. For example, if the number of tilings for 2×132\times 13 is 1346513465, output 34653465. If the answer has fewer than 44 digits, output it directly without leading zeros, e.g., when N=3N=3, output 55.

Input Format

A single integer NN, the length of the wall.

Output Format

Output the last 44 digits of the number of tilings; if it has fewer than 44 digits, output the entire answer.

13
3465

Hint

Constraints: 1N10000001\leq N\leq 1000000.

Translated by ChatGPT 5