#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int dp[4101][2101],s[4101][2101],n,m,k,ans=0;
inline int S(int x,int y){return y>=0?s[x][y]:0;}
int main()
{
	cin>>n>>m>>k;
	dp[0][0]=s[0][0]=1;
	for(int i=1;i<=m;i++)s[0][i]=s[0][i-1];
	for(int i=1;i<n+m;i++)
	{
		for(int j=0;j<=m;j++)dp[i][j]=(S(i-1,j)-S(i-1,j-k)+mod)%mod;
		for(int j=0;j<=m;j++)s[i][j]=(S(i,j-1)+dp[i][j])%mod;
		int pos=i*(k-1)-n+1;
		while(pos<=m)ans=(ans+(mod+dp[i][pos]-dp[i-1][pos])%mod)%mod,pos+=k-1;
	}
	cout<<ans<<endl;
}
