#include <bits/stdc++.h>
using namespace std;
int uf[2000];
int c;
int find(int x) {
  if (uf[x] < 0) return x;
  return uf[x] = find(uf[x]);
}
int uni(int x, int y) {
  int xx = find(x), yy = find(y);
  if (xx != yy) {
    c--;
    if (uf[xx] > uf[yy]) {
      uf[yy] += uf[xx];
      uf[xx] = yy;
    } else {
      uf[xx] += uf[yy];
      uf[yy] = xx;
    }
  }
}
int main(void) {
  long long int mod = 1000000007;
  long long int answ;
  long long int m;
  int n, k;
  cin >> n >> m >> k;
  c = n;
  memset(uf, -1, sizeof uf);
  for (int i = 0; i + k - 1 < n; i++) {
    for (int uu = 0; uu < k / 2; uu++) uni(i + uu, i + k - 1 - uu);
  }
  answ = 1;
  for (int i = 0; i < c; i++) answ = (answ * m) % mod;
  cout << answ << endl;
}
