Under construction

Still being built. Things may change

2 by n Tiling 2

Interview

Time limit1sMemory limit256 MB

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

Easy3 of 10

Topics
Dynamic programming
Solved
No attempts yet

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. (1≤n≤10001 \le n \le 1000)

Output

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

Examples3

  1. Example 1

    Input
    2
    
    Expected output
    3
    
  2. Example 2

    Input
    8
    
    Expected output
    171
    
  3. Example 3

    Input
    12
    
    Expected output
    2731