PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000018. Đếm tháp (Counting Towers)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm tháp (Counting Towers)

Counting Towers

Source: CSES

Version: Phuoc Hung OJ Extended

Problem Statement

Consider a rectangular board of size 2×n2\times n. Divide the whole board into rectangles whose side lengths are positive integers.

The rectangles must not overlap or extend beyond the board, and their union must cover every cell. Two partitions are distinct if their rectangle boundaries differ.

Count all valid partitions modulo 109+710^9+7.

Input

One line contains the integer nn, the length of a board of width 22.

Output

Print the number of valid partitions modulo 109+710^9+7.

Subtasks

  • Subtask 1 (20 points): 1≤n≤501\le n\le 50.
  • Subtask 2 (30 points): 1≤n≤500001\le n\le 50000.
  • Subtask 3 (50 points): 1≤n≤1061\le n\le 10^6.

Examples

Input

2

Output

8

Explanation

For n=2n=2, the board is 22 by 22. Counting all distinct partitions into rectangles with positive integer side lengths yields 88, so the program prints 8.