#P2699. 【数学 1】小浩的幂次运算

【数学 1】小浩的幂次运算

Description

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

Input Format

The input consists of one line with three integers l,r,wl,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-1.

1 10 2
1 2 4 8
2 4 5
-1

Hint

Constraints
For 100%100\% of the testdata: 1lr1×10181\le l\le r \le 1 \times 10^{18} , 1w1091\le w \le10^9.

Translated by ChatGPT 5