#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  unsigned long long cnt;
  if (k == 1 || k > n) {
    cnt = m;
    for (int i = 2; i <= n; i++) cnt = cnt * m % 1000000007;
  } else if (n == k) {
    cnt = m;
    for (int i = 2; i <= (n + 1) / 2; i++) cnt = cnt * m % 1000000007;
  } else if (k % 2 == 0)
    cnt = m;
  else
    cnt = m * m % 1000000007;
  cout << cnt;
  return 0;
}
