#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int b1, b, q, l, m, inf, zero, i, display;
  map<int, int> mymap;
  cin >> b1 >> q >> l >> m;
  int a[m + 4];
  for (i = 0; i < m; i++) {
    cin >> a[i];
    mymap[(int)a[i]]++;
  }
  inf = 0;
  zero = 0;
  if (abs(q) == 1 || q == 0 || b1 == 0 || abs(b1) == 1) {
    if (q == -1) {
      if (mymap.find((-1) * b1) != mymap.end() && mymap.find(b1) != mymap.end())
        zero = 1;
      else
        inf = 1;
    } else if (q == 1) {
      if (mymap.find(b1) == mymap.end())
        inf = 1;
      else
        zero = 1;
    } else if (q == 0 || b1 == 0) {
      if (mymap.find(0) == mymap.end()) {
        inf = 1;
      } else {
        zero = 1;
        if (b1 != 0 && abs(b1) <= l) {
          if (mymap.find(b1) == mymap.end()) {
            cout << "1\n";
          } else {
            cout << "0\n";
          }
          return 0;
        }
      }
    }
  }
  if (abs(b1) > l)
    cout << "0\n";
  else if (inf == 1)
    cout << "inf" << endl;
  else if (zero == 1)
    cout << "0\n";
  else {
    b = b1;
    display = 0;
    while (abs(b) <= l) {
      if (mymap.find(b) == mymap.end()) display++;
      b = b * q;
    }
    cout << display << endl;
  }
  return 0;
}
