#include <bits/stdc++.h>

const int MAXN = 2010;
const int mod = 1000000007;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int n, m, K;
int f[2][MAXN][2], pre[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m >> K;
	int now = 1, lst = 0, ans = 0;
	f[now][0][0] = 1;
	for (int len = 1, lim = (n + m - 1) / (K - 1); len <= lim; ++len) {
		std::swap(lst, now);
		for (int i = 0; i <= m; ++i) {
			reduce(pre[i] = f[lst][i][0] + f[lst][i][1] - mod);
			f[now][i][0] = pre[i];
			if (i) {
				reduce(pre[i] += pre[i - 1] - mod);
				f[now][i][1] = pre[i - 1];
				if (i - K >= 0) reduce(f[now][i][1] -= pre[i - K]);
			}
			if ((m - i) % (K - 1) == 0 && (K - 1) * len + 1 - i <= n)
				reduce(ans += f[now][i][1] - mod);
		}
	}
	std::cout << ans << std::endl;
	return 0;
}
