#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
const int MOD = 1000000007;
int main() {
  istream &fin = cin;
  ostream &fout = cout;
  FILE *fpin = stdin;
  FILE *fpout = stdout;
  int n, m, k;
  fin >> n >> m >> k;
  if (k > n || k == 1) {
    int res = 1;
    for (int i = 0; i < n; i++) {
      res = (long long)res * m % MOD;
    }
    fout << res << endl;
  } else if (k == n) {
    int res = 1;
    for (int i = 0; i < (k + 1) / 2; i++) {
      res = (long long)res * m % MOD;
    }
    fout << res << endl;
  } else {
    if (k & 1) {
      int res = m * m % MOD;
      fout << res << endl;
    } else {
      fout << m << endl;
    }
  }
}
