#include<bits/stdc++.h>
#define reg register int
#define il inline
#define fi first
#define se second
#define mk(a,b) make_pair(a,b)
#define numb (ch^'0')
#define pb push_back
#define solid const auto &
#define enter cout<<endl
#define pii pair<int,int>
using namespace std;
typedef long long ll;
template<class T>il void rd(T &x){
    char ch;x=0;bool fl=false;while(!isdigit(ch=getchar()))(ch=='-')&&(fl=true);
    for(x=numb;isdigit(ch=getchar());x=x*10+numb);(fl==true)&&(x=-x);}
template<class T>il void output(T x){if(x/10)output(x/10);putchar(x%10+'0');}
template<class T>il void ot(T x){if(x<0) putchar('-'),x=-x;output(x);putchar(' ');}
template<class T>il void prt(T a[],int st,int nd){for(reg i=st;i<=nd;++i) ot(a[i]);putchar('\n');}
namespace Modulo{
const int mod=1e9+7;
int ad(int x,int y){return (x+y)>=mod?x+y-mod:x+y;}
void inc(int &x,int y){x=ad(x,y);}
int mul(int x,int y){return (ll)x*y%mod;}
void inc2(int &x,int y){x=mul(x,y);}
int qm(int x,int y=mod-2){int ret=1;while(y){if(y&1) ret=mul(x,ret);x=mul(x,x);y>>=1;}return ret;}
}
using namespace Modulo;
namespace Miracle{
const int N=2002;
const int M=4000000+5+N+N;
int n,k;
int f[2][N];
int jie[M],inv[M];
int C(int n,int m){
    if(n<0||m<0||n<m) return 0;
    return mul(jie[n],mul(inv[m],inv[n-m]));
}
int main(){
    rd(n);rd(k);
    if(k==1){
        puts("1");return 0;
    }
    int lim=n*k+n+n;
    jie[0]=1;
    for(reg i=1;i<=lim;++i) jie[i]=mul(jie[i-1],i);
    inv[lim]=qm(jie[lim]);
    for(reg i=lim-1;i>=0;--i) inv[i]=mul(inv[i+1],i+1);
    int tmp=0;
    f[0][0]=1;
    for(reg i=2*n;i>=1;--i){
        tmp^=1;
        memset(f[tmp],0,sizeof f[tmp]);
        int re=2*n-i;
        for(reg j=0;j<=min(re,n);++j){
            if(!f[tmp^1][j]) continue;
            int le=re-j;
            if(le+1<=j) f[tmp][j]=ad(f[tmp][j],f[tmp^1][j]);
            if(j!=n){
                f[tmp][j+1]=ad(f[tmp][j+1],mul(f[tmp^1][j],C(k-2+le+j*(k-1),le+j*(k-1))));
            }
        }
    }
    ll ans=mul(f[tmp][n],jie[n]);
    ot(ans);
    return 0;
}

}
signed main(){
    Miracle::main();
    return 0;
}

/*
   Author: *Miracle*
*/
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

void debug(vec &v) {
	int n = v.size();
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << v[i];
	}
	cout << endl;
}

ll mod_pow(ll x, ll n) {
	ll ret = 1;
	while (n > 0) {
		if (n % 2)ret = ret * x%mod;
		x = x * x%mod; n >>= 1;
	}
	return ret;
}
struct perm {
private:
	int sz;
	vector<ll> p, invp;
public:
	perm(int n) {
		sz = n + 1;
		p.resize(sz), invp.resize(sz);
		p[0] = 1;
		rep1(i, sz - 1) {
			p[i] = p[i - 1] * i%mod;
		}
		invp[sz - 1] = 1;
		ll cop = mod - 2, x = p[sz - 1];
		while (cop) {
			if (cop % 2)invp[sz - 1] = invp[sz - 1] * x%mod;
			cop >>= 1; x = x * x % mod;
		}
		per(i, sz - 1) {
			invp[i] = invp[i + 1] * (i + 1) % mod;
		}
	}
	ll comb(ll x, ll y) {
		if (x < y || y < 0)return 0;
		ll ret = p[x];
		(ret *= invp[y]) %= mod;
		(ret *= invp[x - y]) %= mod;
		return ret;
	}
	ll combP(ll x, ll y) {
		if (x < y || y < 0)return 0;
		return p[x] * invp[x - y] % mod;
	}
};
perm pm(1 << 22);

ll dp[2001];
ll rdp[2002];
ll nex[2001];

void solve() {
	int n, k; cin >> n >> k;
	if (k == 1) {
		cout << 1 << endl; return;
	}
	dp[1] = 1;
	for (int i = 2; i < 2002; i++)rdp[i] = 1;
	rep1(i, n - 1) {
		for (int j = 1; j <= i + 1; j++) {
			int num = i * k - (j - 1);
			nex[j] = (rdp[i + 1] - rdp[j - 1])*pm.comb(num + k - 2, num);
			nex[j] = (nex[j] % mod + mod) % mod;
		}
		for (int j = 1; j <= i + 1; j++) {
			dp[j] = nex[j];
			rdp[j + 1] = (rdp[j] + dp[j]) % mod;
		}
	}
	ll ans = rdp[n + 1];
	rep1(i, n)ans = ans * i%mod;
	cout << ans << endl;
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(12);
	//init();
	//int t; cin >> t; rep(i, t)solve();
	solve();
	//stop
	return 0;
}
