#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
const int M = 1e9 + 7;
const int N = 2000 + 1;
vector<int> g[N];
vector<char> used(N);
void dfs(int v) {
  used[v] = true;
  for (auto i : g[v])
    if (!used[i]) dfs(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  int l = 0, r = k - 1;
  while (r < n) {
    for (int i = l; i <= r; i++) {
      g[i].push_back(r - i + l);
    }
    l++;
    r++;
  }
  int count = 0;
  for (int i = 0; i < n; i++)
    if (!used[i]) dfs(i), count++;
  long long ans = 1;
  while (count--) ans *= m, ans %= M;
  cout << ans;
}
