#include <bits/stdc++.h>
using namespace std;
long long n, m, k, i, j = 1;
int main() {
  cin >> n >> m >> k;
  while (j <= m) {
    if (j >= n) {
      cout << j << " ";
      i = 1;
    }
    if (m / j >= k)
      j *= k;
    else
      break;
  }
  if (i == 0) cout << -1;
}
