#include <bits/stdc++.h>
std::set<int> S;
int B, Q, L, M, W;
int main() {
  for (scanf("%d%d%d%d", &B, &Q, &L, &M); M--;) {
    scanf("%d", &W);
    S.insert(W);
  }
  if (B < -L || B > L) {
    puts("0");
    return 0;
  }
  if (Q == 0 || B == 0) {
    puts(S.find(0) == S.end() ? "inf" : S.find(B) == S.end() ? "1" : "0");
    return 0;
  }
  if (Q == 1) {
    puts(S.find(B) == S.end() ? "inf" : "0");
    return 0;
  }
  if (Q == -1) {
    puts(S.find(B) == S.end() || S.find(-B) == S.end() ? "inf" : "0");
    return 0;
  }
  W = 0;
  for (long long i = B; i >= -L && i <= L; i *= Q)
    if (S.find(i) == S.end()) W++;
  printf("%d\n", W);
  return 0;
}
