#include <bits/stdc++.h>

using namespace std;

const int Mod = 1e9+7;

const int Nmax = 4004;
int ans=0, n, m, k, i, j, d[Nmax][Nmax], sum[Nmax][Nmax];

int main()
{
   // freopen("input", "r", stdin);
   // freopen("output", "w", stdout);

    scanf("%d%d%d", &n, &m, &k);

    d[0][0] = 1;
    for(i=0; i<=n; ++i) sum[0][i] = 1;

    for(i=1; i<=n+m; ++i) /// lungimea secventei
        for(j=0; j<=n; ++j) /// suma secventei
        {
            d[i][j] = sum[i-1][j] - (j>=k ? sum[i-1][j-k] : 0);
            if(d[i][j]<0) d[i][j] += Mod;

            sum[i][j] = (j ? sum[i][j-1] : 0) + d[i][j];
            if(sum[i][j]>=Mod) sum[i][j] -= Mod;
        }


    for(i=n%(k-1); i<=n; i+=k-1) /// suma secventei
        for(j=1; j<=n+m; ++j) /// lungimea secventei
            if( (m-j*(k-1)+i-1) >= 0 && (m-j*(k-1)+i-1) % (k-1) == 0 )
            {
                ans += d[j][i] - d[j-1][i]; /// nu pot avea 0 pe ultima pozitie
                if(ans>=Mod) ans -= Mod;
                else if(ans<0) ans += Mod;
            }


    printf("%d\n", ans);

    return 0;
}
