#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
using namespace std;
typedef long long LL;
const int N=4010;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int f[N][N];
int main()
{
	const int mod=1e9+7;
	int n=gi(),m=gi(),k=gi(),i,j,ans=0,s;
	f[0][0]=1;
	for (i=1;i<=(n+m)/(k-1);i++) {
		for (j=s=0;j<=m;j++) {
			(s+=f[i-1][j])%=mod;
			if (j>=k) (s-=f[i-1][j-k])%=mod;
			f[i][j]=s;
			if (!((j-m)%(k-1))&&!(((j+n-1)%(k-1)))&&(i-1)*(k-1)+k-j<=n)
				(ans+=(f[i][j]-f[i-1][j])%mod)%=mod;
		}
	}
	printf("%d\n",(ans+mod)%mod);
	return 0;
}
