-100 0 50 1
0
 -1000 0 10 1
5
 -3 1 100 1
3
 1000000000 100000 1000000000 4
5433 13 6 0
 5 1 5 5
1 2 3 4 0
 2 -1 6 1
2
 3 2 30 3
-691070108 -934106649 -220744807
 0 8 5 1
9
 2 -1 1 1
1
 3 2 115 16
24 48 12 96 3 720031148 -367712651 -838596957 558177735 -963046495 -313322487 -465018432 -618984128 -607173835 144854086 178041956
 0 1 1 1
0
 -1000000000 -1000000000 1 1
232512888
 0 2 2143435 4
54343 -13 6 124
 0 69 12 1
1
 3 1 3 1
5
 0 5 8 1
10
 3 2 30 1
3
 2 -1 10 1
2
 -5 -1 10 1
-5
 -1 -1 2143435 4
-1 -123 -5453 141245
 11 0 228 5
-1 0 1 5 -11245
 123 -1 2143435 5
-123 0 123 -5453 141245
 2 2 4 1
2
 3 0 1 1
3
 0 4 1 1
2
 3 2 3 4
6 14 25 48
 3 2 25 2
379195692 -69874783
 -10 1 5 1
100
 1000000000 999999998 1000000000 1
0
 0 3 3 1
1
 1 0 2 1
1
 0 -3 2143435 5
-1 0 1 5 -11245
 11 0 1111 1
11
 2 0 3 1
2
 100 10 2 1
100
 0 5 10 1
2
 123 -1 10000 1
123
 1 5 10000 1
125
 123 0 2143435 4
5433 0 -123 -645
 11 0 228 5
-1 -17 1 5 -11245
 0 23 3 1
3
 3 0 3 1
4
 5 -1 3 1
0
 123 0 2143435 4
5433 0 123 -645
 2 -1 3 1
2
 2 -2 10 1
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
 -1000 0 100 1
2
 123 -1 2143435 5
-123 0 12 5 -11245
 1 1 1000000000 1
100
 3 0 3 1
0
 1 0 2143435 4
1 -123 -5453 141245
 -3 0 1 1
-3
 2 0 2 1
-1
 123 -1 2143435 4
54343 -13 6 123
 -100 -1 1 1
1
 2 -1 100 1
2
 10 -1 2 1
1
 -1000 0 100 1
-1000
 0 3 100 1
5
 5 2 100 1
5
 -4 1 1 1
0
 -20 0 10 1
0
 -5 0 1 1
1
 10 -1 3 2
10 8
 0 35 2 1
3
 0 5 100 2
34 56
 11 0 2 5
-1 0 1 5 -11245
 0 2 100 1
5
 123 0 125 1
123
 100 0 100000 1
100
 1 -1 1 1
1
 1 -1 2143435 4
1 -123 -5453 141245
 2 2 4 1
3
 15 -1 15 4
15 -15 1 2
 3 2 24 4
6 14 25 48
 1 -1 2 1
1
 123 0 21 4
543453 -123 6 1424
 0 2 30 4
6 14 25 48
 10 10 10 1
123
 2 0 2 1
2
 0 4 1000 3
5 6 7
 -2 0 1 1
1
 0 10 10 1
2
 5 1 2 1
2
 3 3 104 17
9 -73896485 -290898562 5254410 409659728 -916522518 -435516126 94354167 262981034 -375897180 -80186684 -173062070 -288705544 -699097793 -11447747 320434295 503414250
 -10 0 5 1
0
 -3 1 100 1
-3
 0 8 10 1
5
 5 0 20 1
5
 0 0 2143435 5
-1 -153 1 5 -11245
 4 0 4 1
0
 2 0 1 1
2
 5 -1 100 1
5
 1 -2 1000000000 1
0
 0 2 5 1
1
 1 -1 10 1
1

0
 0
 inf
 1
 inf
 inf
 4
 inf
 0
 1
 0
 0
 inf
 inf
 inf
 inf
 3
 inf
 inf
 inf
 1
 0
 1
 0
 inf
 1
 4
 0
 1
 inf
 inf
 0
 inf
 inf
 0
 inf
 inf
 5
 1
 inf
 inf
 inf
 0
 0
 inf
 3
 inf
 0
 inf
 inf
 1
 inf
 0
 inf
 inf
 0
 inf
 0
 0
 inf
 4
 0
 0
 0
 0
 inf
 inf
 0
 inf
 inf
 inf
 inf
 inf
 2
 0
 3
 inf
 0
 inf
 1
 inf
 inf
 0
 inf
 0
 3
 0
 0
 inf
 inf
 inf
 1
 0
 inf
 30
 inf
 inf

#include <bits/stdc++.h>
const long long int oo = (long long int)1e18 + 10;
const int inf = 0x3f3f3f3f;
const double PHI = ((sqrt(5) + 1) / 2);
const double PI = acos(-1.0);
using namespace std;
long long int CEIL(long long int, long long int);
long long int FLOOR(long long int a, long long int b) {
  if (b < 0)
    return FLOOR(-a, -b);
  else if (a < 0)
    return -1 * CEIL(-a, b);
  else
    return a / b;
}
long long int CEIL(long long int a, long long int b) {
  if (b < 0)
    return CEIL(-a, -b);
  else if (a < 0)
    return -1 * FLOOR(-a, b);
  else
    return (a + b - 1) / b;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int exgcd(long long int a, long long int b, long long int &x,
                    long long int &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long int xx, yy, g = exgcd(b % a, a, xx, yy);
  x = yy - (b / a) * xx;
  y = xx;
  return g;
}
int bin1(long long int x) {
  int r = 0;
  while (x) {
    r++;
    x &= x - 1;
  }
  return r;
}
long long int power(long long int b, long long int e) {
  if (e == 0) return 1;
  if (e % 2 == 0) return power(b * b, e / 2);
  return b * power(b * b, e / 2);
}
double powerf(double b, int e) {
  if (e == 0) return 1;
  if (e % 2 == 0)
    return powerf(b * b, e / 2);
  else {
    if (e > 0)
      return b * powerf(b * b, e / 2);
    else
      return powerf(b * b, e / 2) / b;
  }
}
long long int modpow(long long int b, long long int e, long long int m) {
  long long int r = 1;
  b = b % m;
  while (e > 0) {
    if (e % 2 == 1) r = (r * b) % m;
    e /= 2;
    b = (b * b) % m;
  }
  return r;
}
long long int modinverse(long long int a, long long int mod) {
  return modpow(a, mod - 2, mod);
}
long long int modinverse2(long long int a, long long int m) {
  long long int x, y;
  exgcd(a, m, x, y);
  while (x < 0) x += m;
  return x;
}
long long int nCrmod(long long int n, long long int r, long long int m) {
  if (r > n) r = n - r;
  long long int res = 1;
  for (long long int i = r; i >= 1; i--) {
    res = (res * (n - i + 1)) % m;
    res = (res * modinverse(i, m));
  }
  return res;
}
long long int nCr(long long int n, long long int r) {
  if (r > n) r = n - r;
  long long int res = 1;
  for (long long int i = r; i >= 1; i--) {
    res *= (n - i + 1);
    res /= i;
  }
  return res;
}
long long int totient(long long int n) {
  long long int res = n, p;
  for (p = 2; p * p <= n; p++) {
    if (n % p == 0) {
      while (n % p == 0) n /= p;
      res -= res / p;
    }
  }
  if (n > 1) res -= res / n;
  return res;
}
bool isprime(long long int x) {
  if (x == 1) return false;
  for (long long int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
bool isvowel(char c) {
  if (isupper(c)) c = tolower(c);
  return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
}
bool istriangle(long long int a, long long int b, long long int c) {
  return (a + b > c) && (a + c > b) && (b + c > a);
}
long long int stringmod(string s, long long int mod) {
  long long int res = 0;
  for (unsigned int i = 0; i < s.size(); i++)
    res = (res * 10 + s[i] - '0') % mod;
  return res;
}
long long int powinfact(long long int n, long long int p) {
  long long int res = 0, pw = p;
  while (n >= pw) {
    res += (n / pw);
    pw *= p;
  }
  return res;
}
vector<vector<long long int> > matrixmultiply(vector<vector<long long int> > A,
                                              vector<vector<long long int> > B,
                                              long long int n) {
  vector<vector<long long int> > C(2, vector<long long int>(n));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
  return C;
}
vector<vector<long long int> > modmatrixmultiply(
    vector<vector<long long int> > A, vector<vector<long long int> > B,
    long long int n, long long int mod) {
  vector<vector<long long int> > C(2, vector<long long int>(n));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++) C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % mod;
  return C;
}
vector<vector<long long int> > powermatrix(vector<vector<long long int> > A,
                                           long long int exp, long long int n) {
  if (exp == 1) return A;
  if (exp % 2) return matrixmultiply(A, powermatrix(A, exp - 1, n), n);
  vector<vector<long long int> > X = powermatrix(A, exp / 2, n);
  return matrixmultiply(X, X, n);
}
vector<vector<long long int> > modpowmatrix(vector<vector<long long int> > A,
                                            long long int exp, long long int n,
                                            long long int mod) {
  if (exp == 1) return A;
  if (exp % 2)
    return modmatrixmultiply(A, modpowmatrix(A, exp - 1, n, mod), n, mod);
  vector<vector<long long int> > X = modpowmatrix(A, exp / 2, n, mod);
  return modmatrixmultiply(X, X, n, mod);
}
long long int merge(long long int a[], long long int l, long long int m,
                    long long int r) {
  long long int i = l, j = m + 1, k = 0, inv_cnt = 0, temp[r - l + 1];
  while (i <= m && j <= r) {
    if (a[i] <= a[j])
      temp[k++] = a[i++];
    else {
      temp[k++] = a[j++];
      inv_cnt += (m - i + 1);
    }
  }
  while (i <= m) temp[k++] = a[i++];
  while (j <= r) temp[k++] = a[j++];
  for (i = l; i <= r; i++) a[i] = temp[i - l];
  return inv_cnt;
}
long long int mergesort(long long int a[], long long int l, long long int r) {
  long long int inv_count = 0;
  if (l < r) {
    long long int m = (l + r) / 2;
    inv_count += mergesort(a, l, m);
    inv_count += mergesort(a, m + 1, r);
    inv_count += merge(a, l, m, r);
  }
  return inv_count;
}
double dist(long long int x1, long long int y1, long long int x2,
            long long int y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void pre() {}
void gcj() {
  long long int t;
  cin >> t;
  for (long long int c = 1; c <= t; c++) {
    cout << "Case #" << c << ": ";
    cout << endl;
  }
}
map<long long int, bool> mx;
void judge() {
  long long int b, q, l, m, n, x, term, ans = 0;
  cin >> b >> q >> l >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> x;
    mx[x] = true;
  }
  if (q == 0 || q == 1) {
    if (mx[q * b])
      cout << 0;
    else
      cout << "inf";
    return;
  }
  if (q == -1) {
    if (mx[b] && mx[-b])
      cout << 0;
    else
      cout << "inf";
    return;
  }
  n = floor((log(l) - log(((b > 0) ? (b) : (-(b))))) /
            log(((q > 0) ? (q) : (-(q)))));
  term = b;
  for (long long int i = 0; i < n + 1; i++) {
    if (!mx[term]) ans++;
    term *= q;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  pre();
  long long int tt = 1;
  while (tt--) {
    judge();
  }
  return 0;
}
