#include <bits/stdc++.h>
using namespace std;
const int maxm = 1e5 + 7;
long long b1, q, l, m;
set<long long> s;
long long abbs(long long a) {
  if (a < 0) a = -a;
  return a;
}
int main() {
  scanf("%lld%lld%lld%lld", &b1, &q, &l, &m);
  while (m--) {
    long long t;
    scanf("%lld", &t);
    s.insert(t);
  }
  long long ans = 0;
  if (abbs(b1) > l) {
    printf("0\n");
    return 0;
  }
  if (b1 == 0) {
    if (s.find(0) == s.end())
      printf("inf\n");
    else
      printf("0\n");
    return 0;
  }
  if (q == 0) {
    if (s.find(b1) == s.end()) ans++;
    if (s.find(0) == s.end())
      printf("inf\n");
    else
      printf("%lld\n", ans);
    return 0;
  }
  if (q == 1) {
    if (s.find(b1) == s.end())
      printf("inf\n");
    else
      printf("0\n");
    return 0;
  }
  if (q == -1) {
    if (s.find(b1) == s.end() || s.find(-b1) == s.end())
      printf("inf\n");
    else
      printf("0\n");
    return 0;
  }
  long long k = b1;
  while (abbs(k) <= l) {
    if (s.find(k) == s.end()) ans++;
    k *= q;
  }
  printf("%lld\n", ans);
  return 0;
}
