#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto const &vv : V) os << vv << ",";
  os << "]";
  return os;
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  os << "(" << P.first << "," << P.second << ")";
  return os;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string str;
  int ratio, lmax, nbad, init;
  cin >> init >> ratio >> lmax >> nbad;
  std::vector<int> bad(nbad);
  for (auto &i : (bad)) cin >> i;
  sort((bad.begin()), (bad.end()));
  long long ans = 0;
  if (abs(init) > lmax) {
    cout << 0 << '\n';
    return 0;
  }
  if (init == 0)
    if (binary_search((bad.begin()), (bad.end()), 0)) {
      cout << 0 << '\n';
      return 0;
    } else {
      cout << "inf" << '\n';
      return 0;
    };
  if (ratio == 0) {
    if (binary_search((bad.begin()), (bad.end()), init)) {
      if (binary_search((bad.begin()), (bad.end()), 0)) {
        cout << 0 << '\n';
        return 0;
      } else {
        cout << "inf" << '\n';
        return 0;
      };
    } else {
      if (binary_search((bad.begin()), (bad.end()), 0)) {
        cout << 1 << '\n';
        return 0;
      } else {
        cout << "inf" << '\n';
        return 0;
      };
    }
  }
  if (ratio == 1) {
    if (binary_search((bad.begin()), (bad.end()), init)) {
      cout << 0 << '\n';
      return 0;
    } else {
      cout << "inf" << '\n';
      return 0;
    };
  }
  if (ratio == -1) {
    if (binary_search((bad.begin()), (bad.end()), init) &&
        binary_search((bad.begin()), (bad.end()), -init)) {
      cout << 0 << '\n';
      return 0;
    } else {
      cout << "inf" << '\n';
      return 0;
    };
  }
  for (long long cur = init; abs(cur) <= lmax; cur *= ratio) {
    cerr << "cur"
         << " is " << cur << endl;
    ;
    cerr << "ans"
         << " is " << ans << endl;
    ;
    if (binary_search((bad.begin()), (bad.end()), cur)) continue;
    ans++;
  }
  {
    cout << ans << '\n';
    return 0;
  };
}
