#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll dp1[102][20001];
ll dp2[102][20001];
int main()
{
	int num, kai;
	scanf("%d%d", &num, &kai);
	dp1[num + 1][0] = 1;
	dp2[num + 1][0] = 0;
	int maxi = 0;
	for (int i = num; i >= 1; i--)
	{
		int xx = 0;
		for (int j = 0; j <= maxi; j++)
		{
			for (int k = 0; k <= kai; k++)
			{
				if (k > i)dp1[i][j] = (dp1[i][j] + dp1[i + 1][j]) % mod, dp2[i][j] = (dp2[i][j] + dp2[i + 1][j] + dp1[i + 1][j] * (j + k)) % mod;
				else dp1[i][(j + (j + k) / i)] = (dp1[i][(j + (j + k) / i)] + dp1[i + 1][j]) % mod, dp2[i][j + (j + k) / i] = (dp2[i][(j + (j + k) / i)] + dp2[i + 1][j] + dp1[i + 1][j] * ((j + k) % i)) % mod;
				xx = max(xx, j + (j + k) / i);
			}
		}
		maxi = xx;
	}
	ll sum = 0;
	for (int i = 0; i <= maxi; i++)sum += dp2[1][i];
	printf("%lld\n", sum%mod);
}