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!
The first line of the input contains three space-separated integers *l*, *r* and *k* (1 ≤ *l* ≤ *r* ≤ 10<sup class="upper-index">18</sup>, 2 ≤ *k* ≤ 10<sup class="upper-index">9</sup>).
Note to the first sample: numbers 2<sup class="upper-index">0</sup> = 1, 2<sup class="upper-index">1</sup> = 2, 2<sup class="upper-index">2</sup> = 4, 2<sup class="upper-index">3</sup> = 8 lie within the specified range. The number 2<sup class="upper-index">4</sup> = 16 is greater then 10, thus it shouldn't be printed.
1 10 2
1 2 4 8 
2 4 5
-1
18102 43332383920 28554
28554 815330916 
19562 31702689720 17701
313325401 
11729 55221128400 313
97969 30664297 9597924961 
5482 100347128000 342
116964 40001688 13680577296 
3680 37745933600 10
10000 100000 1000000 10000000 100000000 1000000000 10000000000 
17098 191120104800 43
79507 3418801 147008443 6321363049 
10462 418807699200 2
16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 
30061 641846400000 3
59049 177147 531441 1594323 4782969 14348907 43046721 129140163 387420489 1162261467 3486784401 10460353203 31381059609 94143178827 282429536481 
1 1000000000000000000 2
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888 1099511627776 2199023255552 4398046511104 8796093022208 17592186044416 35184372088832 70368744177664 140737488355328 281474976710656 562949953421312 1125899906842624 2251799813685248 4503599627370496 900719925474099...
32 2498039712000 4
64 256 1024 4096 16384 65536 262144 1048576 4194304 16777216 67108864 268435456 1073741824 4294967296 17179869184 68719476736 274877906944 1099511627776 
1 2576683920000 2
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536 131072 262144 524288 1048576 2097152 4194304 8388608 16777216 33554432 67108864 134217728 268435456 536870912 1073741824 2147483648 4294967296 8589934592 17179869184 34359738368 68719476736 137438953472 274877906944 549755813888 1099511627776 2199023255552 
5 25 5
5 25 
1 90 90
1 90 
95 2200128528000 68
4624 314432 21381376 1453933568 98867482624 
64 426314644000 53
2809 148877 7890481 418195493 22164361129 
198765 198765 198765
198765 
42 2845016496000 12
144 1728 20736 248832 2985984 35831808 429981696 5159780352 61917364224 743008370688 
6 6 3
-1
1 10 11
1 
2 10 11
-1
87 160 41
-1
237171123124584251 923523399718980912 7150
-1
101021572000739548 453766043506276015 8898
-1
366070689449360724 928290634811046396 8230
-1
438133886369772308 942612870269666780 7193
-1
10 10 10
10 
16 16 256
-1
1 1000000000000000000 1000000000
1 1000000000 1000000000000000000 
1000000000000000000 1000000000000000000 1000000000
1000000000000000000 
1000000000 1000000000000000000 1000000000
1000000000 1000000000000000000 
1 1 4
1 
1 999999999999999999 1000000000
1 1000000000 
1 1000000000000000000 999999990
1 999999990 999999980000000100 
1 1000000000000000000 999999984
1 999999984 999999968000000256 
1 1000000000000000000 324325
1 324325 105186705625 34114678301828125 
1 1000000000000000000 999999523
1 999999523 999999046000227529 
1 243 3
1 3 9 27 81 243 
62769392426654367 567152589733560993 688813
326816522793383797 
1 1000000000000000000 690852001
1 690852001 477276487285704001 
1 1000000000000000000 918745157
1 918745157 844092663510954649 
1 1000000000000000000 131299843
1 131299843 17239648771824649 
2861381721051425 2861381721051425 1234
-1
def link_cut_tree():
    a,b,c=list(map(int,input().split()))
    s=''
    j=0
    for i in range(a,b+1):
        if c**j >= a and  c**j <= b:
            s+=str(c**j)+' '
            j+=1
    if s=='':print(-1)
    else:print(s)
link_cut_tree()