#include <bits/stdc++.h>
using namespace std;
long long int pos(long long int r) {
  if (r < 0)
    return -r;
  else
    return r;
}
int main() {
  long long int a, b, c, d;
  cin >> a >> b >> c >> d;
  unordered_set<long long int> uset;
  for (int i = 0; i < d; i++) {
    int r;
    cin >> r;
    uset.insert(r);
  }
  long long int count = 0;
  if (a == 0) {
    if (uset.find(0) == uset.end()) {
      cout << "inf" << endl;
    } else
      cout << 0 << endl;
    return 0;
  }
  if (uset.find(a) == uset.end() && pos(a) <= c) count++;
  if (pos(a) > c) {
    cout << count << endl;
    return 0;
  }
  if (b == 0) {
    if (uset.find(0) == uset.end()) {
      cout << "inf" << endl;
    } else
      cout << count << endl;
    return 0;
  }
  if (b == 1) {
    if (count == 0)
      cout << 0 << endl;
    else
      cout << "inf" << endl;
    return 0;
  }
  if (b == -1) {
    if (uset.find(-a) == uset.end() && count == 1)
      cout << "inf" << endl;
    else if (count == 1 || uset.find(-a) == uset.end())
      cout << "inf" << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  while (pos(a) <= c) {
    a *= b;
    if (uset.find(a) == uset.end() && pos(a) <= c) count++;
  }
  cout << count << endl;
  return 0;
}
