QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#17927. Chocolate and King Game

Estadísticas

Coco wants to play the "King Game" using a $3 \times N$ chocolate bar and one chess king. The King Game (which is unrelated to the drinking game of the same name) is won by starting at the top-left cell of the chocolate bar, visiting every cell exactly once according to the movement rules of a chess king, and finally reaching the bottom-right cell. A king can move to any of the 8 adjacent cells from its current position, but it cannot move outside the chocolate bar.

Coco is curious about the number of ways to win the King Game. Help Coco solve this problem.

Input

The first line contains the integer $N$.

Output

Output the answer modulo $10^9$ on the first line.

Examples

Input 1

2

Output 1

6

Input 2

6

Output 2

11563

Note

$1 \le N \le 10^3$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.