#include <bits/stdc++.h>
using namespace std;
int b1, q, l, m, ms[100006], temp;
map<int, int> nums;
string specCases() {
  if (abs(b1) > l) return "0";
  if (b1 == 0) {
    if (nums.count(0)) return "0";
    return "inf";
  }
  if (q == 0) {
    if (nums.count(0))
      if (!nums.count(b1))
        return "1";
      else
        return "0";
    return "inf";
  }
  if (q == 1) {
    if (nums.count(b1)) return "0";
    return "inf";
  }
  if (q == -1) {
    if (nums.count(b1) && nums.count(b1 * -1)) return "0";
    return "inf";
  }
  return "no";
}
void Solv() {
  string s = specCases();
  if (s != "no") {
    cout << s << endl;
    return;
  }
  long long k = b1;
  long long count = 0;
  if (!nums.count(b1)) count++;
  while (abs(k *= q) <= l) {
    if (!nums.count(k)) count++;
  }
  cout << count << endl;
}
int main() {
  scanf("%d %d %d %d", &b1, &q, &l, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &temp);
    nums[temp] = 1;
  }
  Solv();
  return 0;
}
