#include <bits/stdc++.h>
using namespace std;
long long a[100010];
int main() {
  long long b1, q, l, m, i, k1 = 1, k2 = 1, ans = 0, s, e, mid;
  cin >> b1 >> q >> l >> m;
  if (-l > b1 || b1 > l) {
    cout << 0;
    return 0;
  }
  for (i = 0; i < m; i++) {
    cin >> a[i];
    if (b1 == 0 && a[i] == 0) {
      cout << 0;
      return 0;
    }
    if (q == 0) {
      if (a[i] == 0) k1 = 0;
      if (a[i] == b1) k2 = 0;
    }
    if (q == 1 && a[i] == b1) {
      cout << 0;
      return 0;
    }
    if (q == -1) {
      if (a[i] == -b1) k1 = 0;
      if (a[i] == b1) k2 = 0;
    }
  }
  if (b1 == 0) {
    cout << "inf";
    return 0;
  }
  if (q == 0) {
    if (k1 == 1)
      cout << "inf";
    else if (k2 == 1)
      cout << 1;
    else
      cout << 0;
    return 0;
  }
  if (q == 1) {
    cout << "inf";
    return 0;
  }
  if (q == -1) {
    if (k1 == 1 || k2 == 1) {
      cout << "inf";
      return 0;
    }
    cout << 0;
    return 0;
  }
  sort(a, a + m);
  while (-l <= b1 && b1 <= l) {
    ans++;
    s = 0;
    e = m - 1;
    while (s <= e) {
      mid = (s + e) / 2;
      if (b1 == a[mid]) {
        ans--;
        break;
      } else if (b1 < a[mid])
        e = mid - 1;
      else
        s = mid + 1;
    }
    b1 *= q;
  }
  cout << ans;
}
