#include <bits/stdc++.h>
using namespace std;
inline int setBit(int N, int pos) { return N = N | (1 << pos); }
inline int resetBit(int N, int pos) { return N = N & ~(1 << pos); }
inline bool checkBit(int N, int pos) { return (bool)(N & (1 << pos)); }
long long base, rat, l, m;
set<long long> sett;
int main() {
  long long x, cnt = 0, ans = 0;
  scanf("%lld %lld", &base, &rat);
  scanf("%lld %lld", &l, &m);
  while (m--) {
    scanf("%lld", &x);
    sett.insert(x);
  }
  if (base == 0) {
    if (sett.find(0) == sett.end())
      puts("inf");
    else
      puts("0");
    return 0;
  }
  if (rat == 0) {
    if (llabs(base) > l)
      puts("0");
    else {
      bool a = false, b = false;
      if (sett.find(base) == sett.end()) a = true;
      if (sett.find(0) == sett.end()) b = true;
      if (a) {
        if (b)
          puts("inf");
        else
          puts("1");
      } else {
        if (b)
          puts("inf");
        else
          puts("0");
      }
    }
    return 0;
  }
  long long now = base;
  while (true) {
    if (llabs(now) > l) break;
    if (cnt >= 1000) {
      if (ans == 0)
        puts("0");
      else
        puts("inf");
      return 0;
    }
    cnt++;
    if (sett.find(now) == sett.end()) ans++;
    now *= rat;
  }
  printf("%lld\n", ans);
  return 0;
}
