#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  long long int result;
  if (n < k or k == 1) {
    result = 1;
    for (int i = 1; i <= n; i++) result = (result * m) % mod;
  } else if (n > k) {
    if (k % 2)
      result = (m * m) % mod;
    else
      result = m % mod;
  } else {
    result = 1;
    for (int i = 0; i < n / 2; i++) result = (result * m) % mod;
    if (n % 2) result = (result * m) % mod;
  }
  cout << result << endl;
  return 0;
}
