#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  long long n, m, k;
  cin >> n >> m >> k;
  long long ans;
  if (k == 1 || k > n) {
    ans = 1;
    for (int i = 0; i < n; i++) ans = (ans * m) % 1000000007;
  } else if (n == k) {
    ans = 1;
    for (int i = 0; i < (n + 1) / 2; i++) ans = (ans * m) % 1000000007;
  } else {
    ans = (k % 2) ? m * m : m;
  }
  cout << ans << endl;
  return 0;
}
