#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7,inv2=5e8+4;
inline int poww(long long x,int y)
{
	long long ret=1;
	while(y)
	{
		if(y&1)ret*=x,ret%=MOD;
		x*=x,x%=MOD;
		y>>=1;
	}
	return ret;
}
int n,k;
long long dp[2333][2333];
long long fac[4555555],invfac[4555555];
inline long long c(int a,int b)
{
	return fac[a]*invfac[b]%MOD*invfac[a-b]%MOD;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin>>n>>k;
	if(k==1)return cout<<1<<endl,0;
	fac[0]=1;
	for(int i=1;i<=4000000;i++)fac[i]=fac[i-1]*i%MOD;
	invfac[4000000]=poww(fac[4000000],MOD-2);
	for(int i=4000000;i>=1;i--)invfac[i-1]=invfac[i]*i%MOD;
	dp[n+1][n]=1;
	for(int i=n;i>=1;i--)
	{
		long long sum=0;
		for(int j=n;j>=i;j--)
		{
			sum+=dp[i+1][j];sum%=MOD;
			dp[i][j]=c(n-j+(n-i)*(k-1)+k-2,k-2)*sum%MOD;
//			cerr<<"dp "<<i<<','<<j<<'='<<dp[i][j]<<endl;
		}
	}
	long long sum=0;
	for(int i=1;i<=n;i++)sum+=dp[1][i];
	cout<<sum%MOD*fac[n]%MOD<<endl;
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

const int mod=1000000007;
int n,k,f[4005][2005],fac[16000005],ifc[16000005];
inline void inc(int& x,int y){x=x+y<mod?x+y:x+y-mod;}
inline void dec(int& x,int y){x=x-y>=0?x-y:x-y+mod;}
inline int power(int b,int n){int ans=1;for(;n;n>>=1,b=1ll*b*b%mod)if(n&1)ans=1ll*ans*b%mod;return ans;}
inline int C(int n,int m){return (n<0||m<0||n<m)?0:1ll*fac[n]*ifc[m]%mod*ifc[n-m]%mod;}

int main(){
	// freopen("in.in","r",stdin);
	n=read(),k=read();
	REP(i,fac[0]=1,16000001)fac[i]=1ll*fac[i-1]*i%mod;
	ifc[16000001]=power(fac[16000001],mod-2);
	DREP(i,16000001,1)ifc[i-1]=1ll*ifc[i]*i%mod;
	if(k==1)return puts("1"),0;
	f[0][0]=1;
	REP(i,0,n+n-1)REP(j,0,i>>1)if(f[i][j]){
		if(i-j>j)inc(f[i+1][j+1],f[i][j]);
		int num=(i-j)*(k-1)+j+1;
		inc(f[i+1][j],1ll*(n-i+j)*f[i][j]%mod*C(k-2+num-1,num-1)%mod);
	}
	printf("%d\n",f[n+n][n]);
	return 0;
}
