#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 100500;
const int maxn = 100500;
const int mod = 1000000007;
int mmul(int x, int y) { return (long long)x * y % mod; }
int madd(int x, int y) { return (x + y) % mod; }
int mpow(int x, int k) {
  if (k == 0) return 1;
  return mmul(x, mpow(x, k - 1));
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  if (k > n)
    cout << mpow(m, n) << endl;
  else if (k == 1)
    cout << mpow(m, n) << endl;
  else if (k == n) {
    if (k % 2 == 0)
      cout << mpow(m, n / 2) << endl;
    else
      cout << mpow(m, n / 2 + 1) << endl;
  } else if (k % 2 == 0)
    cout << m << endl;
  else
    cout << mpow(m, 2) << endl;
  return 0;
}
