#include <iostream>
#include <cstdio>

using namespace std;

const int N=2005;
const int P=1000000007;

int f[N][N][2],g[N<<1][N<<1],s[N<<1];
int n,m,K,ans;

inline void update(int &x,int y){(x+=y)%=P;}

int main()
{
	//freopen("average.in","r",stdin),freopen("average.out","w",stdout);
	scanf("%d%d%d",&n,&m,&K),--m;
	for (int i=1;i<K;++i) update(f[i][K-1-i][1],1);
	update(f[0][K-1][0],1);
	for (int i=0;i<=n;++i)
	{
		for (int j=0;j<m+K;++j) s[j]=s[j+1];
		s[m+K]=0;
		for (int j=0;j<=m+K;++j) update(s[j],g[i][j]);
		for (int j=0;j<=m;++j)
			for (int k=0;k<2;++k)
			{
				if (k) update(f[i][j][k],s[j]);
				if (f[i][j][k])
				{
					if (j+K-1<=m) update(f[i][j+K-1][0],f[i][j][k]);
					update(g[i+1][j+K-2],f[i][j][k]);
					if (j) update(g[i+K][j-1],P-f[i][j][k]);
				}
			}
	}
	for (int i=0;i<=n;++i)
		for (int j=0;j<=m;++j)
			if ((i%(K-1)==n%(K-1))&&(j%(K-1)==m%(K-1)))
				update(ans,f[i][j][1]);
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}