第五回日本最強プログラマー学生選手権-予選-(AtCoder Regular Contest 180)
F
Yet Another Expected Value
AtCoder
未评级
原题
← E→
翻译中…

Problem Statement

翻译中…

You are given integers $N$ and $A$.

翻译中…

You will perform the following operations:

翻译中…
  • Generate $N$ real numbers uniformly at random between $0$ and $1$, inclusive. All generations are independent, and the random numbers are uniformly distributed.
  • Call the generated $N$ real numbers $x_1, x_2, \cdots, x_N$ in ascending order. That is, $0 \leq x_1 \leq x_2 \leq \cdots \leq x_N \leq 1$.
  • Your score is given by the following formula:
翻译中…

$\displaystyle \prod_{i=1}^{N} \left(1+\sum_{j=i+1}^N x_j^A \right)$

翻译中…

Calculate the expected value, modulo $10^9+7$, of the score.

翻译中…

Definition of expected value modulo $10^9+7$ It can be proved that the sought expected value is always rational. Furthermore, under the constraints of this problem, it can be proved that if the expected value is expressed as an irreducible fraction $\frac{P}{Q}$, then $Q \neq 0 \pmod{10^9+7}$. Therefore, there exists a unique integer $R$ such that $R \times Q \equiv P \pmod{10^9+7}, 0 \leq R < 10^9+7$. Report this $R$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^4$
  • $1 \leq A \leq 5 \times 10^4$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N A

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2 1
Output #1
666666673
The expected value of the score is $5/3$.
Input #2
1 1
Output #2
1
Input #3
2 2
Output #3
500000005
Input #4
3 2
Output #4
142857147
Input #5
5 3
Output #5
758371066
Input #6
10000 12345
Output #6
32201773
题目信息

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