#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
map<long long int, int> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int b, q, l, m, x;
  cin >> b;
  cin >> q;
  cin >> l;
  cin >> m;
  for (long long int i = 0; i <= m - 1; ++i) {
    cin >> x;
    mp[x] = 1;
  }
  long long int ans = 0;
  if (!q) {
    if (abs(b) > l)
      ans = 0;
    else {
      if (mp[0]) {
        if (b and !mp[b])
          ans = 1;
        else
          ans = 0;
      } else
        ans = -1;
    }
  } else if (!b) {
    if (mp[0]) {
      ans = 0;
    } else
      ans = -1;
  } else if (q == 1) {
    if (abs(b) > l)
      ans = 0;
    else {
      if (mp[b])
        ans = 0;
      else
        ans = -1;
    }
  } else if (q == -1) {
    if (abs(b) > l)
      ans = 0;
    else {
      long long int b1 = b * -1;
      if (mp[b] and mp[b1])
        ans = 0;
      else
        ans = -1;
    }
  } else {
    while (abs(b) <= l) {
      if (!mp[b]) ++ans;
      b *= q;
    }
  }
  if (ans == -1) {
    cout << "inf";
  } else
    cout << ans;
  return 0;
}
