#include <bits/stdc++.h>   using namespace std;   map<long long int, int> mp;   int main() {     long long int b, q, l, m, t;     scanf( %lld%lld%lld%lld , &b, &q, &l, &m);     for (int i = 0; i < m; i++) {       scanf( %lld , &t);       mp[t] = 1;     }     if (b < -l || b > l) {       printf( 0 n );       return 0;     }     if (b == 0) {       if (mp[0])         printf( 0 n );       else         printf( inf n );       return 0;     } else if (q == 0) {       if (mp[b] && mp[0])         printf( 0 n );       else if (!mp[b] && mp[0])         printf( 1 n );       else         printf( inf n );       return 0;     } else if (q == 1) {       if (mp[b])         printf( 0 n );       else         printf( inf n );       return 0;     } else if (q == -1) {       if (mp[b] && mp[-b])         printf( 0 n );       else         printf( inf n );       return 0;     } else {       long long int cont = 0;       while (b <= l && b >= -l) {         if (!mp[b]) cont++;         b *= q;       }       printf( %lld n , cont);     }     return 0;   }   