#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long M = 998244353;
struct Matrix {
  int n;
  long long P, a[205][205];
  Matrix() {}
  Matrix(int _n, long long _P) {
    n = _n;
    P = _P;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        a[i][j] = 0;
      }
    }
  }
  void init() {
    for (int i = 0; i < n; i++) {
      a[i][i] = 1;
    }
  }
  Matrix operator*(const Matrix &B) const {
    Matrix C(n, P);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < n; k++) {
          C.a[i][j] += a[i][k] * B.a[k][j] % P;
        }
        C.a[i][j] %= P;
      }
    }
    return C;
  }
  Matrix operator^(const long long &t) const {
    Matrix A = (*this), res = Matrix(n, P);
    res.init();
    long long tt = t;
    while (tt) {
      if (tt & 1) res = res * A;
      A = A * A;
      tt >>= 1;
    }
    return res;
  }
};
long long exgcd(long long a, long long b, long long &x, long long &y) {
  long long d = a;
  if (b != 0) {
    d = exgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}
long long mod_inv(long long a, long long m) {
  long long x, y;
  exgcd(a, m, x, y);
  return (m + x % m) % m;
}
long long mod_pow(long long x, long long n, long long m) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct BSGS {
  long long a, t, P;
  map<long long, long long> mp;
  void init(long long _a, long long _P) {
    a = _a;
    P = _P;
    t = sqrt(P) + 1;
    long long at = mod_pow(a, t, P);
    mp.clear();
    long long x = 1, k = 0;
    while (k * t < P - 1) {
      mp[x] = k;
      k++;
      x = x * at % P;
    }
  }
  long long find(long long b) {
    long long inv_a = mod_pow(a, P - 2, P);
    for (long long B = 0, a_B = 1; B < t; B++, a_B = a_B * inv_a % P) {
      long long y = b * a_B % P;
      if (mp.find(y) != mp.end()) {
        return mp[y] * t + B;
      }
    }
    return -1;
  }
};
int k;
long long n, m, b[N];
long long solve(long long t, long long y) {
  long long g = 3;
  BSGS tool;
  tool.init(g, M);
  long long k = tool.find(y);
  long long a, b;
  long long d = exgcd(t, M - 1, a, b);
  if (k % d != 0) return -1;
  if (a < 0) {
    a = M - 1 + a;
    b = -b;
    b = t + b;
  }
  a = a * (k / d);
  b = b * (k / d);
  return mod_pow(g, a, M);
}
int main() {
  scanf("%d", &k);
  for (int i = 0; i < k; i++) {
    scanf("%lld", &b[i]);
  }
  scanf("%lld %lld", &n, &m);
  Matrix A(k, M - 1);
  for (int i = 0; i < k; i++) {
    if (i < k - 1) {
      A.a[i][i] = 0;
      A.a[i][i + 1] = 1;
    }
    A.a[k - 1][i] = b[k - 1 - i];
  }
  A = A ^ (n - k);
  long long t = A.a[k - 1][k - 1];
  printf("%lld\n", solve(t, m % M));
}
