#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, mn = 1e17, mx = 0, ans = 0, b;
int main() {
  cin >> b >> m >> mx >> n;
  map<long long, long long> bad, mp;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    bad[a] = 5;
  }
  int cnt = 0;
  while (abs(b) <= mx && cnt < 10000000) {
    cnt++;
    if (!bad[b]) ans++;
    b *= m;
  }
  if (ans > 1000000)
    cout << "inf";
  else
    cout << ans << endl;
  return 0;
}
