#include<bits/stdc++.h>
using namespace std;

const int mo=1e9+7;

int n,m,K,Ans,dp[2010][2010],cc[2010][2010];

int main()
{
#ifdef h10
	freopen("E.in","r",stdin);
	freopen("E.out","w",stdout);
#endif
	int i,j;
	scanf("%d%d%d",&n,&m,&K);
	n--; K--;
	dp[n][m]=1;
	for (i=n;i>=0;i--)
	for (j=m;j>=0;j--)
	{
		if (j) (cc[i][j]+=cc[i+1][j-1])%=mo;
		(dp[i][j]+=cc[i][j])%=mo;
		if (dp[i][j])
		{
			if (!i&&j!=m&&j%K==0)
				(Ans+=dp[i][j])%=mo;
			int L=max(0,K-i)-1,R=min(K,j);
			if (L<R)
			{
				(cc[i-K+R][j-R]+=dp[i][j])%=mo;
				if (i-K+L>=0) (cc[i-K+L][j-L]+=mo-dp[i][j])%=mo;
			}
		}
	}
	printf("%d\n",Ans);
}
