ICM Technex 2018 and Codeforces Round 463 (Div. 1 + Div. 2, combined)
E
Team Work
Codeforces
2400
原题
← DF →
翻译中…

You have a team of $*N*$ people. For a particular task, you can pick any non-empty subset of people. The cost of having $*x*$ people for the task is $*x*^{*k*}$.

翻译中…

Output the sum of costs over all non-empty subsets of people.

翻译中…

Input

翻译中…

Only line of input contains two integers $*N*$ $(1 ≤ *N* ≤ 10^{9})$ representing total number of people and $*k*$ $(1 ≤ *k* ≤ 5000)$.

翻译中…

Output

翻译中…

Output the sum of costs for all non empty subsets modulo $10^{9} + 7$.

翻译中…

Note

翻译中…

In the first example, there is only one non-empty subset ${1}$ with cost $1^{1} = 1$.

翻译中…

In the second example, there are seven non-empty subsets.

翻译中…
  • ${1}$ with cost $1^{2} = 1$
翻译中…
  • ${2}$ with cost $1^{2} = 1$
翻译中…
  • ${1, 2}$ with cost $2^{2} = 4$
翻译中…
  • ${3}$ with cost $1^{2} = 1$
翻译中…
  • ${1, 3}$ with cost $2^{2} = 4$
翻译中…
  • ${2, 3}$ with cost $2^{2} = 4$
翻译中…
  • ${1, 2, 3}$ with cost $3^{2} = 9$
翻译中…

The total cost is $1 + 1 + 4 + 1 + 4 + 4 + 9 = 24$.

翻译中…

样例

Input #1
1 1
Output #1
1
InputCopy OutputCopy
Input #2
3 2
Output #2
24
InputCopy OutputCopy
题目信息
题号
932E
时间限制
2 s
内存限制
256 MB
标签
组合数学
动态规划
数学

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