#include <iostream>
#include <vector>
#include <set>
using namespace std;

const int MAXN = 2000 + 5;
const int MOD = 1e9 + 7;

int N, M, K;
int DP[MAXN * 2][MAXN * 2];
int answer;

inline bool check(int _k, int _n, int _m)
{
	if(!_k)
		return false;
	if(_n > N || _m > M)
		return false;
	if((N - _n) % (K - 1) != 0)
		return false;
	if((M - _m) % (K - 1) != 0)
		return false;
	return true;
}

int main()
{
	cin >> N >> M >> K;

	DP[0][0] = 1;
	for(int i = 0; i < N + M; i += (K - 1))
		for(int j = 0; j <= M; j++)
			for(int k = 0; k < K; k++)
			{
				if(check(k, i - j + k, j + K - k))
					answer = (answer + DP[i][j]) % MOD;
				if(i < N + M - 1)
					DP[i + K - 1][j + k] = (DP[i + K - 1][j + k] + DP[i][j]) % MOD;
			}

	cout << answer << endl ;

	return 0;
}
