#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  if ((n < k) || (k == 1)) {
    long long ans = 1LL;
    for (int i = 0; i < n; ++i)
      ans = (ans * (long long)m) % (long long)1000000007;
    printf("%I64d\n", ans);
  } else if (n == k) {
    int batas = (k + 1) >> 1;
    long long ans = 1LL;
    for (int i = 0; i < batas; ++i) {
      ans = (ans * (long long)m) % (long long)1000000007;
    }
    printf("%I64d\n", ans);
  } else if (k & 1)
    printf("%d\n", m * m);
  else
    printf("%d\n", m);
  scanf(" ");
  return 0;
}
