#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int k;
bool g[2000 + 1][2000 + 1];
bool vis[2000 + 1];
long long ans = 1;
bool can(int i, int j) {
  int d = (j - i) + 1;
  if (d > k) return 0;
  d = k - d;
  if (d % 2 == 1) return 0;
  return ((n - j) >= d / 2) && ((i - 1) >= d / 2);
}
void dfs(int t) {
  if (vis[t]) return;
  vis[t] = 1;
  for (int i = 1; i <= n; i++) {
    if (g[t][i]) dfs(i);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  memset(g, 0, sizeof g);
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (can(i, j)) {
        g[i][j] = 1;
        g[j][i] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ans *= (long long)m;
      ans %= 1000000007ll;
      dfs(i);
    }
  }
  cout << ans;
}
