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