#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

const int MAXN = 2000 + 100;
const int MOD = 1000000000 + 7;

int n, m, k;
int f[MAXN][MAXN];
int ans = 0;

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> m >> k;
	f[0][0] = 1;
	for(int i = 0; i <= n; i++)
		for(int j = 0; j <= m - 1; j++)
			if(f[i][j])
			{
				// cerr << i << ' ' << j << ' ' << f[i][j] << endl;
				for(int x = 0; x <= k - 1; x++)
				{
					int ii = i + x, jj = j + k - 1 - x;
					if(ii <= n && jj <= m - 1)
					{
						f[ii][jj] = (f[ii][jj] + f[i][j]) % MOD;
						if(x && ii % (k - 1) == n % (k - 1))
							ans = (ans + f[i][j]) % MOD;
					}
				}
			}
	cout << ans << endl;


	return 0;
}
