#include <bits/stdc++.h>
using namespace std;
int b, q, l, n, kolvo = 0;
vector<int> a;
bool binpoisk(int x) {
  int l = -1, r = n - 1, m;
  while (r - l > 1) {
    m = (l + r) / 2;
    if (a[m] >= x)
      r = m;
    else
      l = m;
  }
  if (a[r] == x || a[l] == x) return 1;
  return 0;
}
int main() {
  scanf("%d%d%d%d", &b, &q, &l, &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  if (b == 0) {
    if (binpoisk(0) == 0)
      cout << "inf";
    else
      cout << 0;
    return 0;
  }
  if (q == 0) {
    if (abs(b) <= l && binpoisk(0) == 0) {
      cout << "inf";
      return 0;
    }
    if (binpoisk(b) == 0 && abs(b) <= l)
      cout << 1;
    else
      cout << 0;
    return 0;
  }
  if (q == 1) {
    if (binpoisk(b) == 0 && abs(b) <= l)
      cout << "inf";
    else
      cout << 0;
    return 0;
  }
  if (q == -1) {
    if ((binpoisk(b) == 0 || binpoisk(-b) == 0) && abs(b) <= l)
      cout << "inf";
    else
      cout << 0;
    return 0;
  }
  int i = 0;
  long long bb = b;
  while (abs(bb) <= l) {
    if (binpoisk(bb) == 0) kolvo++;
    bb *= q;
  }
  cout << kolvo;
  return 0;
}
