#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int Mod = 1000000007;
int root[N];
int getf(int n) {
  if (n == root[n]) return n;
  return root[n] = getf(root[n]);
}
int main() {
  int n, m, K;
  while (cin >> n >> m >> K) {
    int ans = 1;
    if (K > n) {
      for (int i = 0; i < n; i++) {
        ans = 1LL * ans * m % Mod;
      }
      cout << ans << endl;
      continue;
    }
    for (int i = 1; i <= n; i++) root[i] = i;
    for (int i = 1; i <= n; i++) {
      for (int j = i, k = i + K - 1; j < k && k <= n; j++, k--) {
        int fa = getf(j);
        int fb = getf(k);
        if (fa != fb) root[fa] = fb;
      }
    }
    set<int> st;
    for (int i = 1; i <= n; i++) st.insert(getf(i));
    for (int i = 0; i < st.size(); i++) {
      ans = 1LL * ans * m % Mod;
    }
    cout << ans << endl;
  }
  return 0;
}
