#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
const int N=2002;
int f[N][N],n,m,k,ans;

int main(){
	int i,j,t;
	scanf("%d%d%d",&n,&m,&k);
	for(i=1;i<k;++i) f[i][k-i]=1;//start from 1,not 0
	for(i=1;i<=n;++i)
	 for(j=1;j<=m;++j) if(f[i][j]){
	 	for(t=0;t<k;++t)
	 	 if(i+t<=n && j+k-1-t<=m)
	 	  f[i+t][j+k-1-t]=(f[i+t][j+k-1-t]+f[i][j])%mod;
	    if(i%(k-1)==n%(k-1) && j%(k-1)==m%(k-1))
	    	ans=(ans+f[i][j])%mod;
	 }
	printf("%d\n",ans);
}