P2699 [Mathematics 1] Xiao Hao's Exponentiation

Description

Exponentiation makes Xiao Hao a bit annoyed; recently he encountered some problems. He needs to find all $w^i$ such that $l \le w^i \le r$, so he turned to you.

Input Format

The input consists of one line with three integers $l,r,w$.

Output Format

Output one line with all numbers that satisfy the condition, separated by spaces. If no number satisfies the condition, output $-1$.

Explanation/Hint

Constraints For $100\%$ of the testdata: $1\le l\le r \le 1 \times 10^{18}$ , $1\le w \le10^9$. Translated by ChatGPT 5