2 by n Tiling 2

Count the ways to tile a 2 by n rectangle with dominoes and 2 by 2 squares, modulo 10007.

Easy3Dynamic programmingInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

Write a program that counts the ways to fill a 2×n2 \times n rectangle with 1×21 \times 2, 2×12 \times 1, and 2×22 \times 2 tiles. Tiles must not overlap, must not stick out of the rectangle, and must leave no empty cell.

Two fillings are different if any tile sits in a different place.

Input

The first line contains nn. (1n10001 \le n \le 1000)

Output

Print the number of ways to fill the 2×n2 \times n rectangle, modulo 1000710007, on the first line.