/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 105;

int n, m, ans;
int f[maxn][maxn * maxn];

inline int add(int a, int b){return (a + b) % INF;}
inline void uadd(int &a, int b){(a += b) %= INF;}
inline int mul(int a, int b){return (1ll * a * b) % INF;}
inline void umul(int &a, int b){a = mul(a, b);}

inline int qpow(int a, int b){
	int ret = 1;
	for(; b; b >>= 1){
		if(b & 1){
			umul(ret, a);
		}
		umul(a, a);
	}
	return ret;
}

int main(){
	scanf("%d%d", &n, &m);
	f[n][0] = 1;
	for(int i = n; i > 0; --i) FOR(j, 0, maxn * maxn) if(f[i][j] >= 0){
		REP(k, 0, m){
			if(k > i){
				if(f[i - 1][j] < 0)
					f[i - 1][j] = 0;
				uadd(f[i - 1][j], f[i][j]);
				continue;
			}
			if(j + (j + k) / i < maxn * maxn){
				uadd(f[i - 1][j + (j + k) / i], f[i][j]);
			}
		}
	}
	//for(int i = n; i >= 0; --i) FOR(j, 0, maxn * maxn) if(f[i][j])
		//printf("dp[%d][%d] = %d\n", i, j, f[i][j]);
	FOR(j, 0, maxn * maxn) if(f[0][j] >= 0)
		uadd(ans, mul(f[0][j], j));
	ll res = 0;
	res = mul(n, mul((m * (m + 1) / 2), qpow(m + 1, n - 1)));
	//printf("%d %d %d\n", res, ans, (res - ans + INF) % INF);
	printf("%d\n", (res - ans + INF) % INF);
	return 0;
}
### Prompt

Create a solution in CPP for 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
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 105;

int n, m, ans;
int f[maxn][maxn * maxn];

inline int add(int a, int b){return (a + b) % INF;}
inline void uadd(int &a, int b){(a += b) %= INF;}
inline int mul(int a, int b){return (1ll * a * b) % INF;}
inline void umul(int &a, int b){a = mul(a, b);}

inline int qpow(int a, int b){
	int ret = 1;
	for(; b; b >>= 1){
		if(b & 1){
			umul(ret, a);
		}
		umul(a, a);
	}
	return ret;
}

int main(){
	scanf("%d%d", &n, &m);
	f[n][0] = 1;
	for(int i = n; i > 0; --i) FOR(j, 0, maxn * maxn) if(f[i][j] >= 0){
		REP(k, 0, m){
			if(k > i){
				if(f[i - 1][j] < 0)
					f[i - 1][j] = 0;
				uadd(f[i - 1][j], f[i][j]);
				continue;
			}
			if(j + (j + k) / i < maxn * maxn){
				uadd(f[i - 1][j + (j + k) / i], f[i][j]);
			}
		}
	}
	//for(int i = n; i >= 0; --i) FOR(j, 0, maxn * maxn) if(f[i][j])
		//printf("dp[%d][%d] = %d\n", i, j, f[i][j]);
	FOR(j, 0, maxn * maxn) if(f[0][j] >= 0)
		uadd(ans, mul(f[0][j], j));
	ll res = 0;
	res = mul(n, mul((m * (m + 1) / 2), qpow(m + 1, n - 1)));
	//printf("%d %d %d\n", res, ans, (res - ans + INF) % INF);
	printf("%d\n", (res - ans + INF) % INF);
	return 0;
}
```