#include <bits/stdc++.h>
using namespace std;
int main() {
  long long b, q, l;
  int m;
  cin >> b >> q >> l >> m;
  map<long long, int> bad;
  for (int i = 0; i < m; i++) {
    long long x;
    cin >> x;
    if (b == 0 or q == 0) {
      if (x == 0 or x == b) bad[x] = 1;
    } else if ((abs(x) % abs(b) == 0 and abs(x) % abs(q) == 0) or x == abs(b))
      bad[x] = true;
  }
  int cnt = 0;
  long long term = b;
  int steps = 0;
  while (steps < 101) {
    if (abs(term) > l) break;
    long long cur = term;
    if (!bad[cur]) cnt++;
    term *= q;
    steps++;
  }
  if (cnt > 35)
    cout << "inf"
         << "\n";
  else
    cout << cnt << "\n";
  return 0;
}
