Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.

You are given geometric progression *b* defined by two integers *b*<sub class="lower-index">1</sub> and *q*. Remind that a geometric progression is a sequence of integers *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, *b*<sub class="lower-index">3</sub>, ..., where for each *i* &gt; 1 the respective term satisfies the condition *b*<sub class="lower-index">*i*</sub> = *b*<sub class="lower-index">*i* - 1</sub>·*q*, where *q* is called the common ratio of the progression. Progressions in Uzhlyandia are unusual: both *b*<sub class="lower-index">1</sub> and *q* can equal 0. Also, Dvastan gave Masha *m* "bad" integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*m*</sub>, and an integer *l*.

Masha writes all progression terms one by one onto the board (including repetitive) while condition |*b*<sub class="lower-index">*i*</sub>| ≤ *l* is satisfied (|*x*| means absolute value of *x*). There is an exception: if a term equals one of the "bad" integers, Masha skips it (doesn't write onto the board) and moves forward to the next term.

But the lesson is going to end soon, so Masha has to calculate how many integers will be written on the board. In order not to get into depression, Masha asked you for help: help her calculate how many numbers she will write, or print "inf" in case she needs to write infinitely many integers.
The first line of input contains four integers *b*<sub class="lower-index">1</sub>, *q*, *l*, *m* (-10<sup class="upper-index">9</sup> ≤ *b*<sub class="lower-index">1</sub>, *q* ≤ 10<sup class="upper-index">9</sup>, 1 ≤ *l* ≤ 10<sup class="upper-index">9</sup>, 1 ≤ *m* ≤ 10<sup class="upper-index">5</sup>) — the initial term and the common ratio of progression, absolute value of maximal number that can be written on the board and the number of "bad" integers, respectively.

The second line contains *m* distinct integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*m*</sub> (-10<sup class="upper-index">9</sup> ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — numbers that will never be written on the board.
In the first sample case, Masha will write integers 3, 12, 24. Progression term 6 will be skipped because it is a "bad" integer. Terms bigger than 24 won't be written because they exceed *l* by absolute value.

In the second case, Masha won't write any number because all terms are equal 123 and this is a "bad" integer.

In the third case, Masha will write infinitely integers 123.
3 2 30 4
6 14 25 48
3
123 1 2143435 4
123 11 -5453 141245
0
123 1 2143435 4
54343 -13 6 124
inf
3 2 25 2
379195692 -69874783
4
3 2 30 3
-691070108 -934106649 -220744807
4
3 3 104 17
9 -73896485 -290898562 5254410 409659728 -916522518 -435516126 94354167 262981034 -375897180 -80186684 -173062070 -288705544 -699097793 -11447747 320434295 503414250
3
-1000000000 -1000000000 1 1
232512888
0
11 0 228 5
-1 0 1 5 -11245
1
11 0 228 5
-1 -17 1 5 -11245
inf
0 0 2143435 5
-1 -153 1 5 -11245
inf
123 0 2143435 4
5433 0 123 -645
0
123 -1 2143435 5
-123 0 12 5 -11245
inf
123 0 21 4
543453 -123 6 1424
0
3 2 115 16
24 48 12 96 3 720031148 -367712651 -838596957 558177735 -963046495 -313322487 -465018432 -618984128 -607173835 144854086 178041956
1
-3 0 92055 36
-92974174 -486557474 -663622151 695596393 177960746 -563227474 -364263320 -676254242 -614140218 71456762 -764104225 705056581 -106398436 332755134 -199942822 -732751692 658942664 677739866 886535704 183687802 -784248291 -22550621 -938674499 637055091 -704750213 780395802 778342470 -999059668 -794361783 796469192 215667969 354336794 -60195289 -885080928 -290279020 201221317
inf
0 -3 2143435 5
-1 0 1 5 -11245
0
123 -1 2143435 5
-123 0 123 -5453 141245
0
123 0 2143435 4
5433 0 -123 -645
1
11 0 2 5
-1 0 1 5 -11245
0
2 2 4 1
2
1
1 -2 1000000000 1
0
30
0 8 10 1
5
inf
-1000 0 10 1
5
0
0 2 2143435 4
54343 -13 6 124
inf
0 8 5 1
9
inf
-10 1 5 1
100
0
123 -1 2143435 4
54343 -13 6 123
inf
-5 -1 10 1
-5
inf
2 0 1 1
2
0
0 5 8 1
10
inf
0 5 100 2
34 56
inf
15 -1 15 4
15 -15 1 2
0
10 -1 2 1
1
0
2 0 2 1
2
inf
4 0 4 1
0
1
10 10 10 1
123
1
2 2 4 1
3
2
0 1 1 1
0
0
3 2 30 1
3
3
1000000000 100000 1000000000 4
5433 13 6 0
1
-2 0 1 1
1
0
2 -1 10 1
2
inf
1 -1 2 1
1
inf
0 10 10 1
2
inf
0 35 2 1
3
inf
3 1 3 1
5
inf
3 2 3 4
6 14 25 48
1
0 69 12 1
1
inf
100 0 100000 1
100
inf
0 4 1000 3
5 6 7
inf
0 2 100 1
5
inf
3 2 24 4
6 14 25 48
3
0 4 1 1
2
inf
1 5 10000 1
125
5
2 -1 1 1
1
0
0 3 100 1
5
inf
0 3 3 1
1
inf
0 2 5 1
1
inf
5 -1 100 1
5
inf
-20 0 10 1
0
0
3 0 1 1
3
0
2 -1 3 1
2
inf
1 1 1000000000 1
100
inf
5 -1 3 1
0
0
0 5 10 1
2
inf
123 0 125 1
123
inf
2 -1 100 1
2
inf
5 2 100 1
5
4
-5 0 1 1
1
0
-3 0 1 1
-3
0
2 -2 10 1
1
3
0 2 30 4
6 14 25 48
inf
1 -1 1 1
1
inf
2 -1 6 1
2
inf
-3 1 100 1
-3
0
1 0 2 1
1
inf
1000000000 999999998 1000000000 1
0
1
1 0 2143435 4
1 -123 -5453 141245
inf
-1000 0 100 1
-1000
0
100 10 2 1
100
0
-3 1 100 1
3
inf
123 -1 10000 1
123
inf
1 -1 2143435 4
1 -123 -5453 141245
inf
5 1 5 5
1 2 3 4 0
inf
-100 -1 1 1
1
0
10 -1 3 2
10 8
0
-10 0 5 1
0
0
3 0 3 1
0
1
2 0 2 1
-1
inf
5 0 20 1
5
inf
-4 1 1 1
0
0
11 0 1111 1
11
inf
2 0 3 1
2
inf
-1 -1 2143435 4
-1 -123 -5453 141245
inf
-100 0 50 1
0
0
5 1 2 1
2
0
3 0 3 1
4
inf
0 23 3 1
3
inf
-1000 0 100 1
2
0
1 -1 10 1
1
inf
import math

b, q, l, m = map(int, input().split())
denied = map(int, input().split())


if (q == 1):
    if b in denied:
        print(0)
        quit()
    else:
        print("inf")
        quit()

if q == -1:
    negated = map(negate, denied)
    if b in denied and b in negated:
        print(0)
        quit()
    else:
        print("inf")
        quit()

if q == 0:
    if 0 in denied:
        print(0)
    else:
        print("inf")
    quit()

terms = int(math.log(l / b, q) + 1)
result = terms

for number in denied:
    n = math.log(number / b, q) + 1
    print(n)
    if n < terms:
        if int(n) == n:
            result -= 1

print(result)


def negate(n):
    return -n
