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