#include <bits/stdc++.h>
int main() {
  int i, n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  if (k < n && k != 1) {
    if (k % 2 == 0) {
      printf("%d\n", m);
    } else {
      printf("%d\n", m + (m * (m - 1)));
    }
  } else {
    long long int ans = 1, mod = 1000000007;
    int end = n;
    if (k == n) end = end / 2 + end % 2;
    for (i = 0; i < end; i++) {
      ans = ans * m;
      ans %= mod;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
