TouchStone
  Please Login
Login Sign Up
 Homepage  Problem Set  Examinations  Submissions  Discussions  Statistics
  • Home
  • Problem Set
  • P5322
  • Problem
  • P5322序列求和2
    Limits : Time Limit : 25000 MS   Memory Limit : 165536 KB
    Judgment Tips : 1.5s,128m
    Description

    \(T(n) = n^k,S(n) = T(1) + T(2) + ...... T(n)。给出n和k,求S(n)。\)

    例如$k = 2,n = 5,S(n) = 12 + 22 + 32 + 42 + 5^2 = 55$

    由于结果很大,输出S(n) Mod 1000000007的结果即可。

    Input Format

    2个数,N, K中间用空格分割。\((1 <= N <= 10^{18}, 1 <= K <= 50000)\)

    Output Format

    S(n) Mod 1000000007的结果。

    Sample Input 1

    5 3

    Sample Output 1

    225

    Sample Input 2

    1484661209616000 40804

    Sample Output 2

    7403815