408030: GYM102964 D Krosh and series sum
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
D. Krosh and series sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output
Krosh has a homework: calculate the sum of the following series: $$$\sum\limits_{n = 1}^{\infty} \frac{n^k}{2^n}$$$, where $$$k$$$ is given. Help him to calculate it. It's guaranteed that the answer is integer. Output it modulo $$$10^9+7$$$.
InputYou are given an integer $$$1 \le k \le 5000$$$.
OutputOutput the answer modulo $$$10^9+7$$$.
ExamplesInput1Output
2Input
2Output
6