#include <bits/stdc++.h>
using namespace std;
map<int, bool> isBad;
vector<int> sequence;
int main() {
  int a0, q, mx, m, res = 0;
  cin >> a0 >> q >> mx >> m;
  for (int tmp, i = 0; i < m; ++i) {
    cin >> tmp;
    isBad[tmp] = true;
  }
  if ((((a0 == 0 || q == 0) && !isBad[0]) ||
       (abs(q) == 1 && (!isBad[a0] || !isBad[a0 * q]))) &&
      abs(a0) <= mx)
    cout << "inf";
  else if (a0 == 0 || abs(q) <= 1) {
    if (q == 0)
      cout << !isBad[a0] * (abs(a0) <= mx);
    else
      cout << 0;
  } else {
    long long tmp = a0;
    while (abs(tmp) <= mx) {
      if (!isBad[tmp]) ++res;
      tmp *= q;
    }
    cout << res;
  }
  cout << endl;
  return 0;
}
