#include <bits/stdc++.h>
using namespace std;
using ll = long long;
unordered_set<ll> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string answer = "0";
  ll a = 0;
  ll tt;
  ll b1, q, l, m;
  cin >> b1 >> q >> l >> m;
  for (int i = 0; i < m; i++) {
    cin >> tt;
    st.insert(tt);
  }
  if (b1 > l || b1 < -l) {
    a = 0;
  } else if (q == 0) {
    if (!st.count(b1)) {
      a++;
    }
    if (!st.count(0)) {
      answer = "inf";
    }
  } else if (b1 == 0) {
    if (!st.count(0)) {
      answer = "inf";
    }
  } else if (q == 1) {
    if (!st.count(b1)) {
      answer = "inf";
    }
  } else if (q == -1) {
    if (!st.count(b1)) {
      answer = "inf";
    }
    if (!st.count(-b1)) {
      answer = "inf";
    }
  } else {
    ll b = b1;
    for (b = b1; b <= l && b >= -l; b *= q) {
      if (!st.count(b)) a++;
    }
  }
  if (answer == "0") {
    answer = to_string(a);
  }
  cout << answer << '\n';
  return 0;
}
