#include <bits/stdc++.h>
using namespace std;
int a[100005];
map<long long int, bool> chk;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int b, q, l, m;
  bool _q = false, _b = false, __b = false;
  cin >> b >> q >> l >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    if (a[i] == b) _b = true;
    if (a[i] == q) _q = true;
    if (a[i] == (-b)) __b = true;
  }
  if ((abs(b)) > (abs(l))) {
    cout << 0;
    return 0;
  }
  if (b == 0 || q == 1) {
    if (_b)
      cout << 0;
    else
      cout << "inf";
    return 0;
  }
  if (q == -1) {
    if (_b && __b)
      cout << 0;
    else
      cout << "inf";
    return 0;
  }
  if (q == 0) {
    if (_b && _q)
      cout << 0;
    else if (_q)
      cout << 1;
    else
      cout << "inf";
    return 0;
  }
  long long int p = b;
  long int c = 0;
  while (abs(p) <= abs(l)) {
    c++;
    chk[p] = true;
    p *= q;
  }
  if (!c) {
    cout << c;
    return 0;
  }
  for (int i = 1; i <= m; i++)
    if (chk[a[i]]) c--;
  cout << c;
  return 0;
}
