#include <bits/stdc++.h>
using namespace std;
char _buf[1024];
int _bytes_read_ = 1024 - 1;
char *_s = _buf + _bytes_read_;
inline char getc1() {
  if (_s >= _buf + _bytes_read_) {
    _bytes_read_ = fread(_buf, 1, 1024 - 1, stdin);
    _buf[_bytes_read_] = 0;
    _s = _buf;
  }
  return *(_s++);
}
inline int readint() {
  char t = getc1();
  int n = 1, res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline long long readLL() {
  char t = getc1();
  int n = 1;
  long long res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = (long long)10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline char skipwhitespace() {
  char ch = getc1();
  while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1();
  return ch;
}
inline int readline(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline int readstr(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != ' ' && ch != '\t' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline string readstring(int n) {
  char buf[n + 1];
  readstr(buf);
  string s(buf);
  return s;
}
inline double readdouble() {
  char buf[40];
  readstr(buf);
  double d;
  sscanf(buf, "%lf", &d);
  return d;
}
inline long double readLD() {
  char buf[80];
  readstr(buf);
  long double d;
  sscanf(buf, "%Lf", &d);
  return d;
}
inline char readchar() { return skipwhitespace(); }
char outbuf[1024];
int outbuf_p;
inline void putc1(char ch) {
  if (outbuf_p >= 1024) {
    fwrite(outbuf, 1, 1024, stdout);
    outbuf_p = 0;
  }
  outbuf[outbuf_p++] = ch;
}
inline void flush() {
  fwrite(outbuf, 1, outbuf_p, stdout);
  outbuf_p = 0;
}
inline void writeint(int n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[10];
  int i = 9;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 10) putc1(buf[i]);
}
inline void writeLL(long long n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[25];
  int i = 24;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 25) putc1(buf[i]);
}
inline void writestr(char *s) {
  char *p = s;
  while (*p) {
    putc1(*p);
    p++;
  }
}
inline void writedouble(double d, int p) {
  char buf[40];
  sprintf(buf, "%.*f", p, d);
  writestr(buf);
}
double my_sqrt(double x, double delta = .00001) {
  double g = x / 2, ng;
  while (fabs(g - (ng = (x / g + g) / 2)) > delta) g = ng;
  return g;
}
template <class T>
void print(vector<T> v) {
  for (T i : v) cout << i << " ";
}
template <class T>
void fill(vector<T> v, T val = 0) {
  fill(v.begin(), v.end(), val);
}
vector<string> split(string S, string D) {
  vector<string> ar;
  int pos = 0, last = 0;
  while ((pos = S.find(D, last)) != string::npos) {
    string sub = S.substr(last, pos - last);
    if (sub.length() > 0) ar.push_back(sub);
    last = pos + D.length();
  }
  string sub = S.substr(last);
  if (sub.length() > 0) ar.push_back(sub);
  return ar;
}
inline long long pow(long long b, long long e) {
  long long ans = 1;
  while (e--) ans *= b;
  return ans;
}
inline long long pow(long long b, long long e, long long mod) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % mod;
    b = b * b % mod;
    e >>= 1;
  }
  return ans;
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long inv(long long a, long long m) {
  long long inv, y;
  assert(egcd(a, m, inv, y) == 1);
  if (inv < 0) inv += m;
  return inv;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
int main() {
  long long L = readLL(), R = readLL(), k = readLL();
  long double p = 1;
  long long x = 0;
  while (1) {
    if (p > R) break;
    if (p >= L and p <= R) {
      x++;
      printf("%lld ", (long long)p);
    }
    p *= k;
  }
  if (x == 0) printf("-1\n");
  return 0;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which is based on Splay trees. Specifically, he is now studying the expose procedure.

Unfortunately, Rostislav is unable to understand the definition of this procedure, so he decided to ask programmer Serezha to help him. Serezha agreed to help if Rostislav solves a simple task (and if he doesn't, then why would he need Splay trees anyway?)

Given integers l, r and k, you need to print all powers of number k within range from l to r inclusive. However, Rostislav doesn't want to spent time doing this, as he got interested in playing a network game called Agar with Gleb. Help him!

Input

The first line of the input contains three space-separated integers l, r and k (1 ≤ l ≤ r ≤ 1018, 2 ≤ k ≤ 109).

Output

Print all powers of number k, that lie within range from l to r in the increasing order. If there are no such numbers, print "-1" (without the quotes).

Examples

Input

1 10 2


Output

1 2 4 8 

Input

2 4 5


Output

-1

Note

Note to the first sample: numbers 20 = 1, 21 = 2, 22 = 4, 23 = 8 lie within the specified range. The number 24 = 16 is greater then 10, thus it shouldn't be printed.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
char _buf[1024];
int _bytes_read_ = 1024 - 1;
char *_s = _buf + _bytes_read_;
inline char getc1() {
  if (_s >= _buf + _bytes_read_) {
    _bytes_read_ = fread(_buf, 1, 1024 - 1, stdin);
    _buf[_bytes_read_] = 0;
    _s = _buf;
  }
  return *(_s++);
}
inline int readint() {
  char t = getc1();
  int n = 1, res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = 10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline long long readLL() {
  char t = getc1();
  int n = 1;
  long long res = 0;
  while (t != '-' && !isdigit(t)) t = getc1();
  if (t == '-') {
    n = -1;
    t = getc1();
  }
  while (isdigit(t)) {
    res = (long long)10 * res + (t & 15);
    t = getc1();
  }
  return res * n;
}
inline char skipwhitespace() {
  char ch = getc1();
  while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = getc1();
  return ch;
}
inline int readline(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline int readstr(char *s) {
  char ch = skipwhitespace();
  int n = 0;
  while ((ch != '\n' && ch != ' ' && ch != '\t' && ch != 0)) {
    s[n++] = ch;
    ch = getc1();
  }
  s[n] = 0;
  return n;
}
inline string readstring(int n) {
  char buf[n + 1];
  readstr(buf);
  string s(buf);
  return s;
}
inline double readdouble() {
  char buf[40];
  readstr(buf);
  double d;
  sscanf(buf, "%lf", &d);
  return d;
}
inline long double readLD() {
  char buf[80];
  readstr(buf);
  long double d;
  sscanf(buf, "%Lf", &d);
  return d;
}
inline char readchar() { return skipwhitespace(); }
char outbuf[1024];
int outbuf_p;
inline void putc1(char ch) {
  if (outbuf_p >= 1024) {
    fwrite(outbuf, 1, 1024, stdout);
    outbuf_p = 0;
  }
  outbuf[outbuf_p++] = ch;
}
inline void flush() {
  fwrite(outbuf, 1, outbuf_p, stdout);
  outbuf_p = 0;
}
inline void writeint(int n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[10];
  int i = 9;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 10) putc1(buf[i]);
}
inline void writeLL(long long n) {
  int sign = n >= 0 ? 1 : -1;
  n = n > 0 ? n : -n;
  char buf[25];
  int i = 24;
  if (!n) buf[i--] = 48;
  while (n) {
    buf[i--] = n % 10 + 48;
    n /= 10;
  }
  if (sign < 0) putc1('-');
  while (++i < 25) putc1(buf[i]);
}
inline void writestr(char *s) {
  char *p = s;
  while (*p) {
    putc1(*p);
    p++;
  }
}
inline void writedouble(double d, int p) {
  char buf[40];
  sprintf(buf, "%.*f", p, d);
  writestr(buf);
}
double my_sqrt(double x, double delta = .00001) {
  double g = x / 2, ng;
  while (fabs(g - (ng = (x / g + g) / 2)) > delta) g = ng;
  return g;
}
template <class T>
void print(vector<T> v) {
  for (T i : v) cout << i << " ";
}
template <class T>
void fill(vector<T> v, T val = 0) {
  fill(v.begin(), v.end(), val);
}
vector<string> split(string S, string D) {
  vector<string> ar;
  int pos = 0, last = 0;
  while ((pos = S.find(D, last)) != string::npos) {
    string sub = S.substr(last, pos - last);
    if (sub.length() > 0) ar.push_back(sub);
    last = pos + D.length();
  }
  string sub = S.substr(last);
  if (sub.length() > 0) ar.push_back(sub);
  return ar;
}
inline long long pow(long long b, long long e) {
  long long ans = 1;
  while (e--) ans *= b;
  return ans;
}
inline long long pow(long long b, long long e, long long mod) {
  long long ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % mod;
    b = b * b % mod;
    e >>= 1;
  }
  return ans;
}
template <class T>
T egcd(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = egcd(b % a, a, x1, y1);
  x = y1 - x1 * (b / a);
  y = x1;
  return d;
}
long long inv(long long a, long long m) {
  long long inv, y;
  assert(egcd(a, m, inv, y) == 1);
  if (inv < 0) inv += m;
  return inv;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
int main() {
  long long L = readLL(), R = readLL(), k = readLL();
  long double p = 1;
  long long x = 0;
  while (1) {
    if (p > R) break;
    if (p >= L and p <= R) {
      x++;
      printf("%lld ", (long long)p);
    }
    p *= k;
  }
  if (x == 0) printf("-1\n");
  return 0;
}

```