func_code_string: #include <bits/stdc++.h>   using namespace std;   const int K = 110;   const int MOD = 998244353;   const int PHI = MOD - 1;   int _w;   void add_phi(int &a, int b) {     a += b;     a -= a >= PHI ? PHI : 0;   }   int pow_mod(int a, int b, int p) {     if (!b) return 1;     long long rtn = pow_mod(a, b >> 1, p);     rtn = rtn * rtn % p;     if (b & 1) rtn = rtn * a % p;     return int(rtn);   }   int inv(int x, int p) { return pow_mod(x, p - 2, p); }   void exgcd(int a, int b, int &d, long long &x, long long &y) {     if (!b) {       d = a, x = 1, y = 0;     } else {       exgcd(b, a % b, d, y, x);       y -= a / b * x;     }   }   int k, b[K], n, m;   int A[K][K], Q[K][K];   void mul(int A[K][K], int B[K][K], int C[K][K]) {     static int tmp[K][K];     memset(tmp, 0, sizeof tmp);     for (int i = 0; i < k; ++i)       for (int j = 0; j < k; ++j)         for (int kk = 0; kk < k; ++kk)           add_phi(tmp[i][j], int(1LL * A[i][kk] * B[kk][j] % PHI));     for (int i = 0; i < k; ++i)       for (int j = 0; j < k; ++j) C[i][j] = tmp[i][j];   }   void fpow(int A[K][K], int b, int C[K][K]) {     static int tmp[K][K];     memset(tmp, 0, sizeof tmp);     for (int i = 0; i < k; ++i) tmp[i][i] = 1;     while (b) {       if (b & 1) mul(tmp, A, tmp);       mul(A, A, A);       b >>= 1;     }     for (int i = 0; i < k; ++i)       for (int j = 0; j < k; ++j) C[i][j] = tmp[i][j];   }   int solve() {     A[0][k - 1] = 1;     for (int i = 1; i < k; ++i) Q[i][i - 1] = 1;     for (int i = 0; i < k; ++i) Q[i][k - 1] = b[i] % PHI;     fpow(Q, n - k, Q);     mul(A, Q, A);     return A[0][k - 1];   }   map<long long, int> mp;   int bsgs(int a, int b, int p) {     mp.clear();     int m = int(sqrt(p) + 1);     long long e = 1;     for (int i = 0; i < m; ++i) {       if (!mp.count(e)) mp[e] = i;       e = e * a % p;     }     long long iv = inv(int(e), p);     int orb = b;     for (int i = 0; i < m; ++i) {       if (mp.count(b)) {         int x = i * m + mp[b];         if (pow_mod(a, x, p) == orb) return x;       }       b = int(b * iv % p);     }     return -1;   }   void kleft(int P, int A, int B) {     int g = 3, bk = bsgs(g, B, P), phip = P - 1;     int d;     long long xk, n;     exgcd(A, -phip, d, xk, n);     if (bk % d) {       puts( -1 );       return;     }     xk *= bk / d, n *= bk / d;     int phip2 = abs(phip / d);     xk = (xk % phip2 + phip2) % phip2;     mp.clear();     long long x = pow_mod(g, int(xk), P);     printf( %lld n , x);   }   int main() {     _w = scanf( %d , &k);     for (int i = 0; i < k; ++i) _w = scanf( %d , b + i);     reverse(b, b + k);     _w = scanf( %d%d , &n, &m);     int tmp = solve();     kleft(MOD, tmp, m);     return 0;   }   