#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2222;
vector<int> conn[N];
bitset<N> seen;
void dfs(int a) {
  seen[a] = true;
  for (int &b : conn[a]) {
    if (!seen[b]) dfs(b);
  }
}
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= min(n / 2, i); j++) {
      int del = k - j;
      int nj = i - j + 1 + del;
      if (nj <= i or nj > n or i + del > n) continue;
      conn[i].push_back(nj);
      conn[nj].push_back(i);
    }
  }
  int result = 1;
  for (int i = 1; i <= n; i++) {
    if (seen[i] == false) {
      dfs(i);
      result = result * 1LL * m % mod;
    }
  }
  cout << result << endl;
}
