#include<cstdio>
#include<cstring>
const int N=2200;


int b[N],n,k,num;
long long bb[N*N],dd[N][N],pp,ans,f[N][N],p=1000000007;
long long xxx;
long long do3(long long x){
	long long s=x,t=x;

	for(int i=2; i<=num; i++){
		s=s*s%p;
		if(b[i]==1) t=t*s%p;
		
	}
	
	return t%p;
}

void do1(int x,int y){
	int mm=k-2;
	int nn=n*k-x-(y-1)*(k-1)-1;
	
//	printf("ccc%d %d %d %d\n",x,y,nn,mm);
	
	long long ans=1,a=1,b=1;
	
	a=bb[nn];
	//b=do3(bb[mm])*do3(bb[nn-mm])%p;
	b=xxx*do3(bb[nn-mm])%p;
//	printf("ccc2  %d %I64d %I64d\n",nn, a,b);
	
	ans=b*a%p;
	
//	printf("ccc3  %I64d\n",ans);
	
	dd[x][y]=ans;
	
}

void do2(){
	long long a=f[n][n];
	
	for(int i=1; i<=n; i++){
		a=a*i%p;
	}
	
	f[n][n]=a;
}

void f1(int x,int y){ 

//	printf("11 %d %d\n",x,y);

	if(x==0){
		f[x][y]=1;
		return;
	}
	if(y==0){
		f[x][y]=1;
		return;
	}
//	printf("22 %d %d\n",x,y);
	
	if(f[x-1][y]==-1 and x-1>=y) f1(x-1,y);
	if(f[x][y-1]==-1 and x>=y-1) f1(x,y-1);
	
//	printf("%d %d %I64d %I64d \n",x, y, f[x-1][y],f[x][y-1]);
	
	f[x][y]=0;
	if(x-1>=y) f[x][y]=(f[x][y]+f[x-1][y])%p;
	
	if(dd[x][y]==-1) do1(x,y);
//	printf("aaa%d %d %I64d %I64d\n",x, y, f[x][y-1], dd[x][y]);
	f[x][y]+=f[x][y-1]*dd[x][y]%p;
	f[x][y]=f[x][y]%p;
//	printf("%d %d %I64d \n",x, y, f[x][y]);
	return;
}



int main(){
//	freopen("leftmost ball.in","r",stdin);
//	freopen("leftmost ball.out","w",stdout);

	scanf("%d%d",&n,&k);
	
	if(k==1){
		printf("1"); 
		return 0;
	}
	bb[0]=1;
	bb[1]=1;
	for(int i=2; i<=n*k; i++){
		bb[i]=bb[i-1]*i%p;
	}
	
	pp=1000000005;
	num=0;
	while(pp>0){
		b[++num]=pp%2;
		pp=pp/2;
	}
	
//	for(int i=num; i>=1; i--) printf("%d",b[i]); printf("\n");
	memset(dd,-1,sizeof(dd));
	memset(f,-1,sizeof(f));
	xxx=do3(bb[k-2]);
	f1(n,n);
	
//	for(int i=0; i<=n; i++){
//		for(int j=0; j<=n; j++){
//			printf("%I64d ",dd[i][j]);
//		}printf("\n");
//	}
	
	do2();
	
	f[n][n]=f[n][n]%p;

	printf("%I64d",f[n][n]);
	
	
	return 0;
}