//In the name of Allah
//#ISART
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2010, mod = 1e9 + 7;
ll dp[N][N], n, m, k;

ll _dp(ll x, ll y){
	if(dp[x][y] != -1)
		return dp[x][y];
	dp[x][y] = 0;
	for(int i = 0; i <= min(k - 1, x); i ++)
		if(y - (k - 1 - i) >= 0)
			dp[x][y] = (dp[x][y] + _dp(x - i, y - (k - 1 - i))) % mod;
	return dp[x][y];
}

int main(){
	cin >> n >> m >> k;
	for(int i = 0; i <= n; i ++)
		for(int j = 0; j <= m; j ++)
			dp[i][j] = -1;
	dp[0][0] = 1;
	_dp(n - 1, m);
	ll ans = 0;
	for(int i = m; i >= 1; i -= k - 1)
		ans = (ans + dp[n - 1][i]) % mod;
	cout << ans;
	return 0;
}
