#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000009;
long long makePow(long long a, long long p) {
  long long res = 1;
  long long cur = a;
  while (p) {
    if (p & 1) {
      res *= cur;
      res %= MOD;
    }
    p = p >> 1;
    cur *= cur;
    cur %= MOD;
  }
  return res;
}
int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    long long ans = 0;
    int groups = n / k;
    int unsafe = max(0, groups - n + m);
    int ost = m - unsafe * k;
    ans = makePow(2, unsafe + 1);
    ans += MOD - 2;
    ans %= MOD;
    ans *= k;
    ans %= MOD;
    ans += ost;
    ans %= MOD;
    cout << ans << endl;
  }
  return 0;
}
