405851: GYM102135 D Friends rescue

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Friends rescuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Once, during the evening walk through the forest, the boy Vova came to the river and saw that his friend Vanya was stuck on the other shore. Vova needs to save his friend, because he can not swim! There are n × (n + 1) islands in the river in the form of a grid. However, there are no bridges between them! There on the shore Vova met an evil wizard Zedikus, who agreed to help him only if Vova solves one difficult task. Vova needs to calculate the number of ways to build bridges so that there is at least one way from one shore to another. Help Vova solve this problem. Vova is allowed to build bridges only between neighboring islands.

More formally, each island has coordinates (r, c) (1 ≤ r ≤ n, 1 ≤ c ≤ n + 1), where r is the line number, and c — column number. If the island has coordinates (r, c), then the neighboring islands have coordinates (r + 1, c), (r, c + 1), (r - 1, c), (r, c - 1), if any exist. The islands that are in the first and last column, that is the islands with coordinates (r, c), where (that is, c is equal to either 1, or n + 1), are already connected to the shores.

The way from one shore to another is a sequence of islands (r1, c1), (r2, c2), ..., (rk, ck) such that for each i (1 ≤ i < k) there is a bridge between the islands (ri, ci) and (ri + 1, ci + 1), also the island (r1, c1) is in the first column (c1 = 1), and the island (rk, ck) is in the last column (ck = n + 1).

Two ways to build bridges are considered different if there is such a bridge that in one way it is built, and in another there is not. For a better understanding, see the illustration of one way to build bridges.

You can see two shores described in the problem statement on the picture. The left shore is denoted as L, and the right one as R. Green circles depict the islands. Rounded rectangles depict the bridges. As can be seen, the shown bridge configuration contains the path between the left and the right shores. As a reminder, the bridges between the left shore L and the left column of the islands are present initially. Same thing goes for the right bank R and the right column of islands. rows and columns arrows correspond to the coordinate axes for rows and columns
Input

The only line of input contains a single integer n (1 ≤ n ≤ 42) — the dimension of the grid of islands.

Output

Output a single integer — the answer to the task modulo 109 + 7.

ExamplesInput
1
Output
1
Input
42
Output
37237670

加入题单

上一题 下一题 算法标签: