#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-8;
int parent[2000 + 5];
int root(int a) {
  int b = a;
  while (a != parent[a]) a = parent[a];
  parent[b] = a;
  return a;
}
void join(int a, int b) {
  a = root(a);
  b = root(b);
  parent[a] = parent[b];
}
int cache[2000 + 5][2000 + 5];
int ncr(int first, int second) {
  if (first == 1 || second == 1 || first == second) return 1;
  if (cache[first][second]) return cache[first][second];
  cache[first][second] = ncr(first - 1, second - 1) + ncr(first, second - 1);
  cache[first][second] %= (1000 * 1000 * 1000 + 7);
  return cache[first][second];
}
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    parent[i] = i;
  }
  for (int i = 0; i < n - k + 1; i++) {
    for (int j = 0; j <= (k) / 2; j++) {
      join(i + j, i + k - j - 1);
    }
  }
  set<int> sets;
  for (int i = 0; i < n; i++) {
    sets.insert(root(i));
  }
  long long ans = 1;
  for (int i = 0; i < sets.size(); i++) {
    ans = (ans * m) % (1000 * 1000 * 1000 + 7);
  }
  cout << ans << endl;
}
int main() {
  srand(time(NULL));
  solve();
  return 0;
}
