#include <bits/stdc++.h>
using namespace std;
long long s2i(string s) {
  istringstream iss(s);
  long long x;
  iss >> x;
  return x;
}
string i2s(long long x) {
  ostringstream oss;
  oss << x;
  return oss.str();
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int ans = 1;
  if (k > n || k == 1) {
    for (int(i) = 0; (i) < (n); (i)++) ans = (ans * (long long)m) % 1000000007;
  } else if (n == k) {
    for (int(i) = 0; (i) < ((n + 1) / 2); (i)++)
      ans = (ans * (long long)m) % 1000000007;
  } else {
    if (k % 2 == 0) {
      ans = m;
    } else {
      ans = m * m;
    }
  }
  cout << ans << endl;
  return 0;
}
