#include <bits/stdc++.h>
using namespace std;
const int zqm = 998244353, phi = zqm - 1, t = ceil(sqrt(zqm)), g = 3, K = 101;
int n;
struct mat {
  int d[K][K];
  inline const int* operator[](const int k) const { return d[k]; }
  inline int* operator[](const int k) { return d[k]; }
  inline mat(bool isunit = 0) {
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= n; ++i) d[i][i] = isunit;
  }
} r;
inline mat operator*(const mat& lhs, const mat& rhs) {
  mat res;
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= n; ++j) {
        res[i][j] = (res[i][j] + lhs[i][k] * 1ll * rhs[k][j]) % phi;
      }
    }
  }
  return res;
}
inline mat qp(mat bas, int exp) {
  mat ret(1);
  for (; exp; exp /= 2, bas = bas * bas)
    if (exp & 1) ret = ret * bas;
  return ret;
}
inline int qp(int bas, int exp) {
  int ret = 1;
  for (; exp; exp /= 2, bas = (bas * 1ll * bas) % zqm)
    if (exp & 1) ret = (ret * 1ll * bas) % zqm;
  return ret;
}
inline int bsgs(int b) {
  static unordered_map<int, int> m;
  if (b == 1) return 0;
  int val = 1;
  m.clear();
  for (int v = 0; v < t; ++v, val = (val * 1ll * g) % zqm)
    m[(val * 1ll * b) % zqm] = v;
  int gt = val;
  for (int u = 1; u <= t; ++u, val = (val * 1ll * gt) % zqm)
    if (m.count(val)) return u * t - m[val];
  return -1;
}
int exgcd(int a, int b, int& x, int& y) {
  if (b == 0) {
    x = 1, y = 0;
    return a;
  }
  int d = exgcd(b, a % b, y, x);
  y -= (a / b) * x;
  return d;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &r[n - i + 1][n]);
  for (int i = 2; i <= n; ++i) r[i][i - 1] = 1;
  int m, x;
  scanf("%d%d", &m, &x);
  r = qp(r, m - n), x = bsgs(x);
  int inv, tmp, d = exgcd(r[n][n], phi, inv, tmp);
  if (x % d) {
    puts("-1");
    return 0;
  }
  cout << qp(g, ((x / d) * 1ll * inv % phi + phi) % phi) << '\n';
  return 0;
}
