#include <bits/stdc++.h>
const int maxn = 1e5 + 5;
double a[maxn];
double eps = 1e-10;
using namespace std;
double power(double x, int b) {
  double r = 1;
  for (int i = 1; i <= b; i++) r *= x;
  return r;
}
int main() {
  double b, q, l, v = 0;
  int m, c = 0;
  long long x, ans = 0, cnt = 0;
  cin >> b >> q >> l >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (a[i] == b) c = 1;
  }
  if (abs(b) > l)
    cout << "0";
  else if (b == 0) {
    if (c == 1)
      cout << "0";
    else
      cout << "inf";
  } else if (q == 0) {
    int c2 = 0;
    for (int i = 0; i < m; i++) {
      if (a[i] == 0) c2 = 1;
    }
    if (c == 1 && c2 == 1)
      cout << "0";
    else if (c2 != 1)
      cout << "inf";
    else if (c2 == 1 && c == 0 && abs(b) <= l)
      cout << "1";
    else if (abs(b) > l)
      cout << "0";
  } else if (q == 1) {
    if (c == 1 || abs(b) > l)
      cout << "0";
    else
      cout << "inf";
  } else if (q == -1) {
    int c2 = 0;
    for (int i = 0; i < m; i++)
      if (a[i] == -1 * b) c2 = 1;
    if (c == 1 && c2 == 1)
      cout << "0";
    else if (abs(b) > l)
      cout << "0";
    else
      cout << "inf";
  } else {
    v = l / abs(b);
    v = log10(v) + eps;
    v = v / log10(abs(q)) + 1;
    ans = floor(v);
    for (int i = 0; i < m; i++) {
      if (abs(a[i]) <= l) {
        v = abs(a[i]) / abs(b);
        v = log10(v) + eps;
        v = v / log10(abs(q));
        long long x = floor(v);
        if (b * power(q, x) == a[i]) {
          cnt++;
        }
      }
    }
    ans -= cnt;
    cout << ans;
  }
  return 0;
}
