#include <bits/stdc++.h>
using namespace std;
const long long inf = 1 << 30;
const long long INF = (long long)1 << 62;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 5;
long long b, q, l, m, a[maxn], ans;
set<long long> s;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> b >> q >> l >> m;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (abs(a[i]) <= l) s.insert(a[i]);
  }
  s.insert(INF);
  if (b == 0LL) {
    auto t = s.find(0LL);
    if (t == s.end()) ans = INF;
  } else if (q == 0LL) {
    if (abs(b) <= l) {
      auto t = s.find(b);
      if (t == s.end()) ans = 1LL;
      t = s.find(0LL);
      if (t == s.end()) ans = INF;
    }
  } else if (q == 1LL) {
    if (abs(b) <= l) {
      auto t = s.find(b);
      if (t == s.end()) ans = INF;
    }
  } else if (q == -1LL) {
    if (abs(b) <= l) {
      auto t = s.find(b);
      if (t == s.end()) ans = INF;
      t = s.find(-b);
      if (t == s.end()) ans = INF;
    }
  } else {
    long long it = b;
    while (abs(it) <= l) {
      auto t = s.find(it);
      if (t == s.end()) ans++;
      it *= q;
    }
  }
  if (ans >= INF)
    cout << "inf";
  else
    cout << ans;
  return 0;
}
