#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const ll INF=1000000000000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const ll M = 1000000007;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret;
	ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	ll n,k;
	cin >> n >> k;
	
	static ll dp[102][5060] = {};
	dp[k][0] = k;
	dp[k][1] = 1;
	for(int i = k-1 ; i >= 1 ; i --){
		for(int j = 0 ; j < 5060 ; j ++){
			dp[i][j] += dp[i+1][j]*(k-i);
			dp[i][j+j/i] += dp[i+1][j]*(i-j%i);
			dp[i][j+j/i+1] += dp[i+1][j]*(j%i+1);
		}
		for(int j = 0 ; j < 5060 ; j ++){
			dp[i][j] %= M;
		}
	}
	
	ll ret = modpow(k+1,k)*n*k; ret %= M;
	ret *= modpow(2,M-2); ret %= M;
	rep1(i,5059){
		dp[1][i] *= i;
		dp[1][i] %= M;
		ret += M-dp[1][i];
	}
	ret %= M;
	ret *= modpow(k+1,n-k);
	cout << ret%M << endl;
}
	


### Prompt

Develop a solution in cpp to the problem described below:

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<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const ll INF=1000000000000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
const ll M = 1000000007;

ll modpow(ll x,ll k){
	if(k == 0)return 1;
	ll ret = modpow(x,k/2);
	ret *= ret;
	ret %= M;
	if(k%2 == 1){
		ret *= x;
		ret %= M;
	}
	return ret;
}

int main(){
	ll n,k;
	cin >> n >> k;
	
	static ll dp[102][5060] = {};
	dp[k][0] = k;
	dp[k][1] = 1;
	for(int i = k-1 ; i >= 1 ; i --){
		for(int j = 0 ; j < 5060 ; j ++){
			dp[i][j] += dp[i+1][j]*(k-i);
			dp[i][j+j/i] += dp[i+1][j]*(i-j%i);
			dp[i][j+j/i+1] += dp[i+1][j]*(j%i+1);
		}
		for(int j = 0 ; j < 5060 ; j ++){
			dp[i][j] %= M;
		}
	}
	
	ll ret = modpow(k+1,k)*n*k; ret %= M;
	ret *= modpow(2,M-2); ret %= M;
	rep1(i,5059){
		dp[1][i] *= i;
		dp[1][i] %= M;
		ret += M-dp[1][i];
	}
	ret %= M;
	ret *= modpow(k+1,n-k);
	cout << ret%M << endl;
}
	


```