#include <bits/stdc++.h>
using namespace std;
int pre[2010];
int find(int x) {
  if (pre[x] == -1) return x;
  return pre[x] = find(pre[x]);
}
int main() {
  int n, m, r;
  cin >> n >> m >> r;
  memset(pre, -1, sizeof(pre));
  for (int i = 1; i + r - 1 <= n; i++) {
    int st = i, ed = i + r - 1;
    for (int i = 0; i + st <= ed; i++) {
      int x = find(st + i);
      int y = find(ed - i);
      if (x != y) pre[x] = y;
    }
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++)
    if (pre[i] == -1) ans = ans * m % 1000000007;
  cout << ans << endl;
  return 0;
}
