#include <bits/stdc++.h>
using namespace std;
bool contains(int size_of_array, int array[], int element) {
  for (int i = 0; i < size_of_array; i++) {
    if (array[i] == element) {
      return true;
    }
  }
  return false;
}
int main() {
  long long first, multiple, limit, number_bad;
  cin >> first >> multiple >> limit >> number_bad;
  int bad_numbers[number_bad];
  for (int i = 0; i < number_bad; i++) {
    cin >> bad_numbers[i];
  }
  int result = 0;
  if (abs(first) > limit) {
    result = 0;
  } else if (first == 0) {
    if (!contains(number_bad, bad_numbers, 0)) {
      result = -1;
    }
  } else if (multiple == 0) {
    if (!contains(number_bad, bad_numbers, first)) {
      result++;
    }
    if (!contains(number_bad, bad_numbers, 0)) {
      result = -1;
    }
  } else if (multiple == 1) {
    if (!contains(number_bad, bad_numbers, first)) {
      result = -1;
    }
  } else if (multiple == -1) {
    if (!contains(number_bad, bad_numbers, first) ||
        !contains(number_bad, bad_numbers, -first)) {
      result = -1;
    }
  } else {
    long long product = first;
    while (abs(product) <= limit) {
      if (!contains(number_bad, bad_numbers, product)) {
        result++;
      }
      product = product * multiple;
    }
  }
  if (result == -1) {
    cout << "inf" << endl;
  } else {
    cout << result << endl;
  }
}
