#include <bits/stdc++.h>
using namespace std;
map<long long, bool> mp;
long long b, q, l, n, x, ans;
signed main() {
  scanf("%lld%lld%lld%lld", &b, &q, &l, &n);
  if (abs(b) > l) {
    printf("0");
    return 0;
  }
  if (l < 0) l = -l;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &x);
    mp[x] = 1;
  }
  if (b == 0) {
    if (mp[0])
      printf("0");
    else
      printf("inf");
    return 0;
  }
  if (q == 1) {
    if (mp[b])
      puts("0");
    else
      printf("inf");
    return 0;
  }
  if (q == -1) {
    if (mp[-b] && mp[b])
      printf("0");
    else
      printf("inf");
    return 0;
  }
  if (q == 0) {
    if (mp[0])
      printf("%d", mp[b] ? 0 : 1);
    else
      printf("inf");
    return 0;
  }
  while (abs(b) <= l) {
    if (!mp[b]) ans++;
    b *= q;
  }
  printf("%lld", ans);
  return 0;
}
