#include<bits/stdc++.h>
#define int long long
#define out(x) cerr << #x << " = " << x << "\n"
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
	x = 0;
	char c = getchar();
	bool f = 0;
	for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
	for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
	if(f) x = -x;
}
// define f[i][j] as the move of di...N = j

const int MaxN = 3200, N = 110;
const int mo = 1e9 + 7;
int f[N][MaxN + 10], n, k, c;
inline void U(int &x, int y, int i, int j) {
	for(x += y; x >= mo; x -= mo);
}

inline void Solve() {
	f[n][1] = (k >= n);
	f[n][0] = 1 + k - f[n][1];
	int Max = 1;
	for(int i = n - 1; i >= 1; i --) {
		for(int st = 0; st <= k; st ++) {
			for(int j = 0; j <= MaxN; j ++)  {
				if(st <= i)
					U(f[i][j + (st + j) / i], f[i + 1][j], i, (j + (st + j) / i));
				else U(f[i][j], f[i + 1][j], i, j);
			}
			
//	for(int i = 0; i <= 3; i ++) cout << f[1][i] << ' ';
//	putchar('\n');
		}
		for(int j = MaxN; ~j; j --) if(f[i][j]) {
			Max = j; break;
		}
	}
}

inline int pow_mod(int a, int k, int mo) {
	int ans = 1;
	for(; k; k >>= 1, a = (a * a) % mo) if(k & 1) ans = (ans * a) % mo;
	return ans;
}
 
main() {
	read(n), read(k);
	Solve();
	puts("233");
	for(int i = 0; i <= 3; i ++) cout << f[1][i] << ' ';
	for(int i = 0; i <= MaxN; i ++) U(c, i * f[1][i], 1, i);
	cout << c << "\n";
    int a = pow_mod(k + 1, n - 1, mo);
    int sum = (k * (k + 1) / 2) % mo;
    (a *= sum) %= mo;
    (a *= n) %= mo;
    cout << a << ' ' << sum << "\n";
    cout << (a - c + mo) % mo << "\n";
    
}