#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

const int N=4*1e3+5,Mo=1e9+7;

int n,m,k,f[N][N][2],ans;

void inc(int &x,int y) {
	x=x+y;
	if (x>=Mo) x=x-Mo;
}

int main() {
	scanf("%d%d%d",&n,&m,&k);
	m--;k--;
	f[0][0][0]=1;
	fo(i,0,(n+m)/k) {
		fo(j,0,n)
			fo(z,0,1)
				if (f[i][j][z]) {
					inc(f[i+1][j+1][1],f[i][j][z]);inc(f[i+1][min(n+1,j+k+1)][1],Mo-f[i][j][z]);
					inc(f[i+1][j][0],f[i][j][z]);inc(f[i+1][j+1][0],Mo-f[i][j][z]);
				}
		fo(j,1,n) fo(z,0,1) inc(f[i+1][j][z],f[i+1][j-1][z]);
	}
	fo(i,1,(n+m)/k) 
		fo(j,0,n)
			if (j%k==n%k&&(i*k-j)%k==m%k&&i*k-j<=m)
				inc(ans,f[i][j][1]);
	printf("%d\n",ans);
	return 0;
}