#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  if (n < k) {
    long long ret = 1;
    for (int i = 0; i < n; i++) {
      ret = (ret * m) % 1000000007;
    }
    cout << ret << endl;
    return 0;
  }
  if (k == 1) {
    long long ret = 1;
    for (int i = 0; i < n; i++) {
      ret = (ret * m) % 1000000007;
    }
    cout << ret << endl;
  } else if (k & 1) {
    if (n == k) {
      long long ret = 1;
      int tt = k / 2 + 1;
      for (int i = 0; i < tt; i++) {
        ret = (ret * m) % 1000000007;
      }
      cout << ret << endl;
    } else {
      cout << m * m << endl;
      return 0;
    }
  } else {
    if (n == k) {
      int tt = n / 2;
      long long ret = 1;
      for (int i = 0; i < tt; i++) {
        ret = (ret * m) % 1000000007;
      }
      cout << ret << endl;
    } else {
      cout << m << endl;
    }
  }
  return 0;
}
