func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod7 = 998244353;   vector<vector<long long> > mul(vector<vector<long long> > &A,                                  vector<vector<long long> > &B,                                  long long mod = mod7) {     vector<vector<long long> > res(A.size(), vector<long long>(B[0].size()));     for (size_t i = 0; i < A.size(); ++i)       for (size_t j = 0; j < B[0].size(); ++j)         for (size_t k = 0; k < B.size(); ++k)           res[i][j] = (res[i][j] + A[i][k] * B[k][j]) % mod;     return res;   }   vector<vector<long long> > pow(vector<vector<long long> > A, long long n,                                  long long mod = mod7) {     vector<vector<long long> > res(A.size(), vector<long long>(A.size()));     for (size_t i = 0; i < A.size(); ++i) res[i][i] = 1;     for (; n; A = mul(A, A, mod), n >>= 1)       if (n & 1) res = mul(res, A, mod);     return res;   }   inline long long gcd(long long a, long long b) {     while (a && b) a > b ? a %= b : b %= a;     return a + b;   }   inline void exgcd(long long a, long long b, long long &x, long long &y) {     for (x = 1, y = 0; b;) {       long long t = a / b;       swap(a -= t * b, b);       swap(x -= t * y, y);     }   }   inline long long mmul(long long a, long long b, long long mod = mod7) {     a *= b;     return a >= mod ? a % mod : a;   }   inline long long minv(long long a, long long mod = mod7) {     if (gcd(a, mod) != 1) return -1;     long long x, y;     exgcd(a, mod, x, y);     return x < 0 ? x + mod : x;   }   inline long long mdiv(long long a, long long b, long long mod = mod7) {     if (a == 0) return 0;     long long g = gcd(b, mod);     if (a % g) return -1;     a /= g, b /= g, mod /= g;     return mmul(a, minv(b, mod), mod);   }   inline long long mpow(long long a, long long n, long long mod = mod7) {     long long res = 1;     for (; n; n >>= 1, a = mmul(a, a, mod))       if (n & 1) res = mmul(res, a, mod);     return res;   }   inline long long mlog(long long a, long long b, long long mod = mod7) {     int s = sqrt(mod) + 1;     long long t = 1;     unordered_map<long long, long long> m;     for (int i = 0; i < s; ++i, t = mmul(t, a, mod)) m[t] = i;     t = minv(t, mod);     for (int i = 0; i < s; ++i, b = mmul(t, b, mod))       if (m.count(b)) return m[b] + i * s;     throw;     return -1;   }   long long find_generator(long long order, long long p) {     vector<int> v;     long long o = order;     for (int i = 2; 1ll * i * i <= o; ++i)       if (o % i == 0) {         v.push_back(order / i);         while (o % i == 0) o /= i;       }     if (o > 1) v.push_back(order / o);     for (long long i = 2, t;; ++i) {       for (int j : v)         if ((t = mpow(i, j, p)) == 1ll) break;       if (t != 1ll) return i;     }   }   inline long long find_order(long long n) {     long long res = n;     for (long long i = 2; i * i <= n; ++i)       if (n % i == 0) {         while (n % i == 0) n /= i;         res /= i;         res *= (i - 1);       }     if (n > 1) res /= n, res *= (n - 1);     return res;   }   inline long long mroot(long long exp, long long b, long long mod = mod7) {     long long o = find_order(mod);     long long g = find_generator(o, mod);     long long o2 = mlog(g, b, mod);     long long o1 = mdiv(o2, exp, o);     if (o1 == -1) return -1;     return mpow(g, o1, mod);   }   long long N, M, K;   long long arr[105];   void init() {     cin >> K;     for (int i = 0; i < K; ++i) cin >> arr[i];     cin >> N >> M;   }   void sol() {     vector<vector<long long> > res(K, vector<long long>(K));     for (int i = 0; i < K; ++i) res[i][0] = arr[i];     for (int i = 1; i < K; ++i) res[i - 1][i] = 1;     res = pow(res, N - K, mod7 - 1);     N = res[0][0];     cout << mroot(N, M, mod7) << endl;   }   int main() {     init();     sol();   }   