#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const long long INF = 1000000000000000000;
long long mod = 1000000007;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  if (k > n) {
    long long res = m;
    int t = min(k, n);
    for (int _n(t - 1), i(0); i < _n; i++) {
      res = (res * m) % mod;
    }
    cout << res << endl;
    return 0;
  }
  if (k == n) {
    long long res = m;
    int t = (k + 1) / 2;
    for (int _n(t - 1), i(0); i < _n; i++) {
      res = (res * m) % mod;
    }
    cout << res << endl;
    return 0;
  }
  if (k % 2 == 0) {
    cout << m << endl;
    return 0;
  }
  if (k == 1) {
    long long res = m;
    for (int _n(n - 1), i(0); i < _n; i++) {
      res = (res * m) % mod;
    }
    cout << res << endl;
    return 0;
  }
  if (n > 1)
    cout << m * m << endl;
  else
    cout << m << endl;
}
