#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
const double eps = 1e-9;
const int INF = 1000000000;
int n, m, k;
bool flag[MAXN][MAXN], exist[MAXN];
void dfs(int x) {
  if (exist[x]) {
    return;
  }
  exist[x] = true;
  for (int i = 0; i < n; ++i)
    if (!exist[i] && flag[x][i]) {
      dfs(i);
    }
}
int main() {
  while (cin >> n >> m >> k) {
    memset(flag, 0, sizeof(flag));
    memset(exist, 0, sizeof(exist));
    for (int st = 0; st + k - 1 < n; ++st) {
      for (int i = 0; i < k; ++i) {
        flag[st + i][st + k - 1 - i] = true;
      }
    }
    int t = 0, ans = 1;
    for (int i = 0; i < n; ++i)
      if (!exist[i]) {
        ++t;
        dfs(i);
      }
    for (int i = 0; i < t; ++i) {
      ans = ((long long)ans * m) % 1000000007;
    }
    cout << ans << endl;
  }
  return 0;
}
