#include <bits/stdc++.h>
using namespace std;
int a[2001], sz[2001];
void init() {
  for (int i = 1; i <= 2000; ++i) a[i] = i, sz[i] = i;
}
int root(int i) {
  while (i != a[i]) {
    a[i] = a[a[i]];
    i = a[i];
  }
  return i;
}
void unn(int p, int q) {
  p = root(p);
  q = root(q);
  if (p == q) return;
  if (sz[q] > sz[p]) swap(p, q);
  sz[p] += sz[q];
  sz[q] = 0;
  a[q] = a[p];
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  init();
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i + k - 1 <= n; ++i) {
    int j = i, jj = i + k - 1;
    while (j < jj) {
      unn(j, jj);
      ++j;
      --jj;
    }
  }
  long long ans = 1LL;
  for (int i = 1; i <= n; ++i) {
    if (i == root(i)) ans = (ans * m) % (long long)1000000007;
  }
  cout << ans;
  return 0;
}
