#include <bits/stdc++.h>
int p[2000], q;
int find(int i) {
  if (p[i] == i) return i;
  return (p[i] = find(p[i]));
}
void un(int i1, int i2) {
  int j1 = find(i1);
  int j2 = find(i2);
  if (j1 != j2) {
    p[j1] = j2;
    q--;
  }
}
void solve(int n) {
  int i, j, k, l, m, r;
  long long int res = 1;
  for (i = 0; i < n; i++) p[i] = i;
  scanf("%d%d", &m, &k);
  q = n;
  for (i = 0; i + k <= n; i++) {
    for (l = i, r = l + k - 1; l < r; l++, r--) un(l, r);
  }
  for (i = 0; i < q; i++) res = (res * m) % 1000000007;
  printf("%I64d\n", res);
}
int main() {
#pragma comment(linker, "/STACK:268435456")
  int n;
  while (scanf("%d", &n) != EOF) {
    solve(n);
  }
  return 0;
}
