#include <bits/stdc++.h>
using namespace std;
int p[2001];
int a[2001];
int find(int v) {
  if (p[v] != v) p[v] = find(p[v]);
  return p[v];
}
void merge(int u, int v) {
  int pu = find(u);
  int pv = find(v);
  p[pu] = pv;
}
int main() {
  int n, m, k, i, l, r;
  cin >> n >> m >> k;
  for (i = 0; i < n; i++) p[i] = i;
  for (i = 0; i < n; i++) {
    l = i;
    r = i + k - 1;
    if (r >= n) break;
    while (l < r) {
      merge(l, r);
      l++;
      r--;
    }
  }
  for (i = 0; i < n; i++) {
    p[i] = find(i);
    a[p[i]]++;
  }
  long long re = 1;
  for (i = 0; i < n; i++)
    if (a[i] > 0) {
      re *= m;
      re %= 1000000007;
    }
  cout << re;
  return 0;
}
