#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n, m, k;
bool d[2001][2001];
bool e[2001];
void search(int a) {
  e[a] = false;
  for (int i = 0; i < n; i++) {
    if (d[a][i] == true && e[i] == true) search(i);
  }
}
int main() {
  cin >> n >> m >> k;
  int cou = 0;
  memset(d, 0, sizeof(d));
  fill(e, e + n, 1);
  for (int i = 0; i <= n - k; i++) {
    for (int j = i; j < i + k; j++) {
      d[j][(i + k - 1) - (j - i)] = d[(i + k - 1) - (j - i)][j] = true;
    }
  }
  for (int i = 0; i < n; i++) {
    if (e[i] == true) {
      search(i);
      cou++;
    }
  }
  long long res = 1ll;
  for (int i = 0; i < cou; i++) {
    res = res * (long long)m;
    res %= mod;
  }
  cout << res << endl;
  return 0;
}
