#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;

#ifdef WIN32
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 105;
const int MOD = 1000000007;

int anspush[maxn * maxn][maxn];
int n, k;

inline void upd(int &a, ll b)
{
    a = (a + b) % MOD;
}

int main()
{
    scanf("%d%d", &n, &k);
    
    ll sum = 0;
    ll cnt = 1;
    anspush[0][n + 1] = 1;
    for (int i = n; i > 0; i--)
    {
        sum = ((ll)sum * (k + 1) + (k + 1) * k / 2 * cnt) % MOD;
        cnt = ((ll)cnt * (k + 1)) % MOD;
        for (int npushs = 0; npushs <= (n - i) * k; npushs++) if (anspush[npushs][i + 1] != 0)
        {
            for (int t = 0; t <= k; t++)
            {
                if (t > i)
                {
                    upd(anspush[npushs][i], anspush[npushs][i + 1]);
                } else
                {
                    upd(anspush[npushs + (t + npushs) / i][i], anspush[npushs][i + 1]);
                }
            }
        }
    }
//     cout << sum << endl;
    for (int i = 0; i <= n * k; i++)
    {
//         cout << i << ' ' << anspush[i][1] << endl;
        sum = (sum - (ll)anspush[i][1] * i) % MOD;
    }
    sum = (sum + MOD) % MOD;
    cout << sum << endl;
    
    return 0;
}