#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAX_N = 2005, MOD = 1000000007;

int N, M, K, f[MAX_N], g[MAX_N];

void update(int &x, int y) {
  x = (x + y) % MOD;
}

int main() {
  scanf("%d%d%d", &N, &M, &K);
  M--;
  
  int len = (N + M) / (K - 1), result = 0, sum = 0;
  f[0] = 1;
  
  for (int i = 1; i <= len; ++i) {
    memset(g, 0, sizeof g);
    sum += K - 1;
    
    for (int j = 0; j <= N; ++j) {
      for (int k = 0; k <= K - 1; ++k) {
	if (j + k <= N && sum - j - k <= M) {
	  update(g[j + k], f[j]);
	  if (k > 0 && (j + k) % (K - 1) == N % (K - 1) && (sum - j - k) % (K - 1) == M % (K - 1))
	    update(result, f[j]);
	}	  
      }
    }
    
    memcpy(f, g, sizeof g);
  }

  printf("%d\n", result);
  return 0;
}
