#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long b1, q, maxx, n;
  cin >> b1 >> q >> maxx >> n;
  set<long long> Q;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    Q.insert(a);
  }
  if (abs(b1) > maxx) {
    cout << 0;
    return 0;
  }
  int ans = 0;
  if (b1 == 0 || q == 0 || q == 1 || q == -1) {
    if (Q.count(b1) == 0) ans++;
    if (b1 == 0 && ans > 0) {
      cout << "inf";
    } else if (b1 == 0) {
      cout << 0;
    } else if (q == 0) {
      if (Q.count(0) == 0)
        cout << "inf";
      else
        cout << ans;
    } else if (q == 1) {
      if (ans > 0)
        cout << "inf";
      else
        cout << ans;
    } else if (q == -1) {
      if (Q.count(b1) == 0 || Q.count(-b1) == 0)
        cout << "inf";
      else
        cout << 0;
    }
    return 0;
  }
  while (abs(b1) <= maxx) {
    if (Q.count(b1) == 0) ans++;
    b1 *= q;
  }
  cout << ans;
  return 0;
}
