#include<iostream>
#include<algorithm>
using namespace std;
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 4010
class CS{
  public:
  ll cs[N];
  void init(ll a[]){
    cs[0]=0;
    for(int i=0;i<N-1;i++){
      cs[i+1]=cs[i]+a[i];
    }
  }
  ll qry(ll l,ll r){
    return (cs[r+1]-cs[l])%mod;
  }
};CS cs;

ll f[N][N],n,m,k;
int main(){
    cin>>n>>m>>k;
    for(int i=0;i<N;i++)f[0][i]=0; f[0][0]=1;
    for(int i=1;i<N;i++){
      cs.init(f[i-1]);
      for(int j=0;j<N;j++){
	f[i][j]=cs.qry(max(0LL,j-k+1),j);
      }
    }
    ll ans=0;
    for(;n>0;n-=(k-1)){
      ll s=(n+m-1)/(k-1);
      //cout<<s<<" "<<n<<" "<<f[s][n]<<endl;
      ans=(ans+f[s][n])%mod;
    }
    cout<<ans<<endl;
    return 0;
}
