AtCoder Grand Contest 053
C
Random Card Game
AtCoder
⌀ 2878
原题
← BD →
翻译中…

Problem Statement

翻译中…

We have $2N$ cards, with ID numbers from $1$ through $2N$. Consider the following game using them.

翻译中…

First, the dealer randomly split the cards into two piles of $N$ cards each. Here, the dealer also randomly chooses the order of cards in each pile. Then, the player repeatedly does the operation below until one pile becomes empty, and the number of operations done will be the score.

翻译中…
  • Choose a positive integer $k$ and compare the $k$-th cards from the top in the two piles. ($k$ should not exceed the number of each pile.) Then, remove the card with the smaller ID number from the pile that contains it.
翻译中…

Assume that a cheater plays this game. That is, assume that the player can always see the ID numbers of all cards in both piles. Find the expected value of the score when the player plays optimally to minimize it, modulo $(10^9 + 7)$ (see Notes).

翻译中…

Note

翻译中…
  • The expected value in question will be a rational number. If we express it as a fractional number $\frac{y}{x}$ where $x$ and $y$ are coprime positive integers, $x$ will be coprime with $P=10^9+7$, so print the only integer $z$ between $0$ and $P-1$ (inclusive) such that $xz \equiv y \pmod P$.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^6$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
1
Output #1
1
Input #2
3
Output #2
486111118
题目信息
题号
agc053_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。