Tiling

Count the ways to tile a 3 by W rectangle with 2 by 1 dominoes, printing the result modulo 1e9+7.

Medium5Dynamic programmingCombinatoricsMathRecursionNo attempts yetTime limit2sMemory limit512 MB

Problem

A domino is a rectangular piece of size 2×12 \times 1, and each of its two squares carries a number from 1 to 6. Dominoes are normally used to play a game, but here they are used for something else.

You can place dominoes without overlaps and without gaps to fill a rectangle of width WW and height 3. The goal is to count how many such fillings exist. The numbers printed on the pieces play no role, so two fillings count as different when the position or the orientation of at least one domino differs.

The figure below shows the three ways of filling a rectangle of width 2 and height 3.

A larger width admits many more fillings. For example, one possible answer for width 12 is this one.

Write a program that computes the number of ways to tile a rectangle of width WW and height 3 with dominoes.

Input

The first line contains the width WW of the rectangle, with 1W10001 \le W \le 1000.

Output

Print the number of fillings on the first line. The value can be very large, so print it modulo 10000000071000000007 (109+710^9 + 7).

Hint

For W=56W = 56 the exact number of fillings is 81551035427317538155103542731753, and the value you print is that number modulo 109+710^9 + 7.