Tiling a 2 by N wall

Count the ways to tile a 2 by N wall with 2x1, 1x2, and 1x1 tiles, modulo 1e9+7.

Medium5Dynamic programmingCombinatoricsNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given a wall of size 2×N2 \times N. Fill the wall completely with tiles of size 2×12 \times 1, 1×21 \times 2 and 1×11 \times 1. Tiles must not overlap, no tile may stick out of the wall, and each size may be used any number of times.

Count the ways to fill the wall. Two ways are different when some cell is covered by a different tile.

Input

The first line contains an integer NN. (1N1,000,0001 \le N \le 1{,}000{,}000)

Output

Print the number of ways to fill the wall, taken modulo 1,000,000,0071{,}000{,}000{,}007, on the first line.