#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int MOD = 1e9 + 7;
int f[N][N], ans;
int n, m, k;
void ADD(int &t, int d) {t += d; if (t >= MOD) t -= MOD;}
int main()
{
    cin >> n >> m >> k;
    f[0][0] = 1;
    for (int i = 0; i <= n; ++ i)
        for (int j = 0; j <= m; ++ j)
            if ((i + j) % (k - 1) == 0)
            {
                for (int p = 0; p < k; ++ p)
                {
                    int q = k - 1 - p;
                    if (i + p > n) continue;
                    if (j + q > m) continue;
                    ADD(f[i + p][j + q], f[i][j]);
                    if (j + q + 1 > m) continue;
                    if (p && ((n - (i + p)) % (k - 1) == 0) && ((m - (j + q + 1)) % (k - 1) == 0))
                        ADD(ans, f[i][j]);
                }
            }
    cout << ans << endl;
}
