#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline string toString(const T& o) {
  ostringstream os("");
  os << o;
  return os.str();
}
template <typename T>
void unique(vector<T>& v) {
  sort(all(v));
  v.erase(unique(all(v)) - v.begin());
}
template <typename T>
void append(vector<T>& v, const vector<T>& u) {
  v.insert(v.end(), (u).begin(), (u).end());
}
bool g[2003][2003];
bool u[2003];
const long long MOD = 1000000007LL;
void dfs(int v, int n) {
  u[v] = true;
  for (int i = 0; i < n; ++i) {
    if (g[v][i] && !u[i]) {
      dfs(i, n);
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int start = 0; start + k - 1 < n; ++start) {
    for (int i = start, j = start + k - 1; i < j; ++i, --j) {
      g[i][j] = g[j][i] = true;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (!u[i]) {
      dfs(i, n);
      ++cnt;
    }
  }
  long long ret = 1;
  for (int i = 0; i < cnt; ++i) {
    ret *= m;
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}
