#include <bits/stdc++.h>
using namespace std;

const int N = 2010, mod = 1e9 + 7;
int n, m, k;
int ans, f[N << 1][N][2], sum[N];

inline int read() {
	int s = 0, f = 1;
	char ch;
	for(; ch < '0' || ch > '9'; ch = getchar())	if(ch == '-')	f = -1;
	for(; ch >= '0' && ch <= '9'; ch = getchar())	s = (s << 1) + (s << 3) + ch - '0';
	return s * f;
}

inline int add(int a, int b) { return (a += b) >= mod ? a - mod : a; }
inline int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
inline void Add(int &a, int b) { a = add(a, b); }

int main() {
	n = read(), m = read(), k = read();
	f[0][0][0] = 1;
	for(int i = 1; i <= (max(n, m) << 1); ++i) {
		sum[0] = add(f[i - 1][0][0], f[i - 1][0][1]);
		for(int j = 1; j <= n; ++j)
			sum[j] = add(sum[j - 1], add(f[i - 1][j][0], f[i - 1][j][1]));
		for(int j = 0; j <= n; ++j) {
			f[i][j][0] = sub(sum[j], sum[j - 1]);
			if(j)	f[i][j][1] = sub(sum[j - 1], (j - k >= 0 ? sum[j - k] : 0));
		}
		for(int j = 0; j <= n; ++j)
			if(j % (k - 1) == n % (k - 1) && (i * (k - 1) - j + 1) % (k - 1) == m % (k - 1) && i * (k - 1) - j + 1 <= m)
				Add(ans, f[i][j][1]);
	}
	printf("%d\n", ans);
	return 0;
}