#include <bits/stdc++.h>
using namespace std;
int dirK[8][2] = {{-2, 1}, {-1, 2},  {1, 2},  {2, 1},
                  {2, -1}, {-1, -2}, {1, -2}, {-2, -1}};
int dir8[8][2] = {{-1, 0},  {0, 1}, {1, 0},  {0, -1},
                  {-1, -1}, {1, 1}, {1, -1}, {-1, 1}};
int dir4[4][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
set<long long> st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, b, q, l, m, num, pre, counter = 0;
  scanf("%lld %lld %lld %lld", &b, &q, &l, &m);
  for (i = 0; i < m; i++) {
    scanf("%lld", &num);
    st.insert(num);
  }
  while (abs(b) <= l) {
    if (st.find(b) == st.end()) {
      counter++;
    }
    pre = b;
    b = pre * q;
    if (abs(b) == abs(pre)) {
      if (st.find(b) != st.end() && st.find(pre) != st.end()) {
        printf("%lld", counter);
      } else {
        printf("inf");
      }
      return 0;
    }
  }
  printf("%lld", counter);
}
