#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main(void) {
  long long a;
  scanf("%lld", &a);
  long long r;
  scanf("%lld", &r);
  long long lim;
  scanf("%lld", &lim);
  long long m;
  scanf("%lld", &m);
  long long int temp, temp2, b = a, q = r, ll, rr, mid, ans = 0;
  set<long long int> xx;
  for (int i = 0; i < m; ++i) {
    long long val;
    scanf("%lld", &val);
    xx.insert(val);
  }
  if (b == 0 || q == 0) {
    long long int hehe = 2;
    long long int modb = (b > 0) ? b : -1 * b;
    if (modb > lim) {
      cout << 0 << endl;
      return 0;
    }
    if (!xx.count(0)) {
      cout << "inf" << endl;
      return 0;
    } else
      hehe--;
    if (xx.count(b)) hehe--;
    cout << hehe << endl;
  } else if (q == 1) {
    long long int ANS = 1;
    if (xx.count(b)) {
      cout << 0 << endl;
    } else {
      if ((b > 0 && b > lim) || (b < 0 && (b * -1) > lim))
        cout << 0 << endl;
      else
        cout << "inf" << endl;
    }
  } else if (q == -1) {
    long long int ANS = 2;
    if (xx.count(b)) {
      ANS--;
    } else {
      if ((b > 0 && b > lim) || (b < 0 && (b * -1) > lim)) ANS--;
    }
    if (xx.count(b * -1)) {
      ANS--;
    } else {
      if ((b > 0 && b > lim) || (b < 0 && (b * -1) > lim)) ANS--;
    }
    if (ANS != 0)
      cout << "inf" << endl;
    else
      cout << 0 << endl;
  } else {
    long long int fans = 0;
    while (fabs(b) <= lim) {
      if (!xx.count(b)) fans++;
      b *= q;
    }
    printf("%lld\n", fans);
  }
  return (0);
}
