#include <bits/stdc++.h>
using namespace std;
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 long long MOD = 1e9 + 7;
struct Val {
  long long num;
  long long dp;
};
int N;
int K;
Val vs[114][21414];
const int MM = 20000;
int main() {
  scanf("%d%d", &N, &K);
  vs[N + 1][0].num = 1;
  vs[N + 1][0].dp = 0;
  for (int(i) = (N + 1) - 1; (i) >= (1); --(i)) {
    for (int(j) = 0; (j) < (MM + 1); ++(j)) {
      for (int(k) = 0; (k) < (K + 1); ++(k)) {
        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];
          (nv.dp += v.dp) %= MOD;
          (nv.dp += long long((k + j) % i) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        } else {
          auto &nv = vs[i][j];
          (nv.dp += v.dp) %= MOD;
          (nv.dp += long long(k + j) * v.num) %= MOD;
          (nv.num += v.num) %= MOD;
        }
      }
    }
  }
  long long ans = 0;
  for (int(i) = 0; (i) < (MM + 1); ++(i)) {
    ans += vs[1][i].dp;
    ans %= MOD;
  }
  printf("%lld\n", ans);
}
