#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

struct Val {
  LL num;
  LL dp;
};

int N;
int K;
Val vs[114][21414];
const int MM = 10014;

int main() {
  scanf("%d%d", &N, &K);
  
  vs[N+1][0].num = 1;
  vs[N+1][0].dp = 0;
  rreps(i, 1, N+1) {
    rep(j, MM+1) {
      rep(k, K+1) {
        auto &v = vs[i+1][j];
        if (k <= i && k+j >= i) {
          int t = (k+j)/i;
          if (j+t > MM) continue;
          auto &nv = vs[i][j+t];
          //printf("dp[%d][%d] <- dp[%d][%d]\n", i, j+t, i+1, j);
          //printf("dp : %lld += %lld\n", nv.dp, LL((k+j) % i) * v.num);
          //printf("num: %lld += %lld\n", nv.num, v.num);
          (nv.dp += v.dp) %= MOD;
          (nv.dp += LL((k+j) % i) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        } else {
          auto &nv = vs[i][j];
          //printf("dp[%d][%d] <- dp[%d][%d]\n", i, j, i+1, j);
          //printf("dp : %lld += %lld\n", nv.dp, LL((k+j)) * v.num);
          //printf("num: %lld += %lld\n", nv.num, v.num);
          (nv.dp += v.dp) %= MOD;
          (nv.dp += LL(k+j) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        }
      }
    }
  }

  /*rreps(i, 1, N+1) {
    printf("dp[%d]:", i);
    rep(j, N*2+1) {
      printf(" (%lld, %lld)", vs[i][j].num, vs[i][j].dp);
    }
    puts("");
  }*/

  LL ans = 0;
  rep(i, MM+1) {
    ans += vs[1][i].dp;
    ans %= MOD;
  }
  
  printf("%lld\n", ans);
}

### Prompt

Your task is to create a CPP solution to the following problem:

Consider the following game:

* The game is played using a row of N squares and many stones.
* First, a_i stones are put in Square i\ (1 \leq i \leq N).
* A player can perform the following operation as many time as desired: "Select an integer i such that Square i contains exactly i stones. Remove all the stones from Square i, and add one stone to each of the i-1 squares from Square 1 to Square i-1."
* The final score of the player is the total number of the stones remaining in the squares.



For a sequence a of length N, let f(a) be the minimum score that can be obtained when the game is played on a.

Find the sum of f(a) over all sequences a of length N where each element is between 0 and K (inclusive). Since it can be extremely large, find the answer modulo 1000000007 (= 10^9+7).

Constraints

* 1 \leq N \leq 100
* 1 \leq K \leq N

Input

Input is given from Standard Input in the following format:


N K


Output

Print the sum of f(a) modulo 1000000007 (= 10^9+7).

Examples

Input

2 2


Output

10


Input

20 17


Output

983853488

### Response

```cpp
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

struct Val {
  LL num;
  LL dp;
};

int N;
int K;
Val vs[114][21414];
const int MM = 10014;

int main() {
  scanf("%d%d", &N, &K);
  
  vs[N+1][0].num = 1;
  vs[N+1][0].dp = 0;
  rreps(i, 1, N+1) {
    rep(j, MM+1) {
      rep(k, K+1) {
        auto &v = vs[i+1][j];
        if (k <= i && k+j >= i) {
          int t = (k+j)/i;
          if (j+t > MM) continue;
          auto &nv = vs[i][j+t];
          //printf("dp[%d][%d] <- dp[%d][%d]\n", i, j+t, i+1, j);
          //printf("dp : %lld += %lld\n", nv.dp, LL((k+j) % i) * v.num);
          //printf("num: %lld += %lld\n", nv.num, v.num);
          (nv.dp += v.dp) %= MOD;
          (nv.dp += LL((k+j) % i) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        } else {
          auto &nv = vs[i][j];
          //printf("dp[%d][%d] <- dp[%d][%d]\n", i, j, i+1, j);
          //printf("dp : %lld += %lld\n", nv.dp, LL((k+j)) * v.num);
          //printf("num: %lld += %lld\n", nv.num, v.num);
          (nv.dp += v.dp) %= MOD;
          (nv.dp += LL(k+j) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        }
      }
    }
  }

  /*rreps(i, 1, N+1) {
    printf("dp[%d]:", i);
    rep(j, N*2+1) {
      printf(" (%lld, %lld)", vs[i][j].num, vs[i][j].dp);
    }
    puts("");
  }*/

  LL ans = 0;
  rep(i, MM+1) {
    ans += vs[1][i].dp;
    ans %= MOD;
  }
  
  printf("%lld\n", ans);
}

```