#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int g = 3;
struct matrix {
  int len;
  long long mat[101][101];
  matrix(int l = 0, int type = 0) {
    len = l;
    if (type == 0) {
      for (int i = 0; i < len; i++)
        for (int j = 0; j < len; j++) mat[i][j] = 0;
    } else if (type == 1) {
      for (int i = 0; i < len; i++) mat[i][i] = 1;
    }
  }
  matrix operator*(const matrix &b) const {
    matrix c(len, 0);
    for (int i = 0; i < len; i++)
      for (int j = 0; j < len; j++)
        for (int k = 0; k < len; k++)
          c.mat[i][j] =
              (c.mat[i][j] + mat[i][k] * b.mat[k][j] % (mod - 1)) % (mod - 1);
    return c;
  }
};
matrix quick_pow(matrix a, int b) {
  matrix ans = matrix(a.len, 1);
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
long long gcd(long long n, long long m) {
  if (m == 0) return n;
  return gcd(m, n % m);
}
long long exgcd(long long n, long long m, long long &x, long long &y) {
  if (m == 0) {
    x = 1;
    y = 0;
    return n;
  }
  long long d = exgcd(m, n % m, y, x);
  y -= n / m * x;
  return d;
}
long long solve(long long a, long long b, long long p) {
  if (b == 0) return 0;
  long long d = gcd(a, p);
  if (b % d) return -1;
  a /= d;
  b /= d;
  p /= d;
  long long x, y;
  exgcd(a, p, x, y);
  x = (x * b) % p;
  if (x < 0) x += p;
  return x;
}
long long quick_pow(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans % mod;
}
unordered_map<long long, long long> Hash;
long long BSGS(long long a, long long b, long long p) {
  int u = (long long)sqrt(p) + 1;
  long long tem = 1;
  Hash.clear();
  for (int i = 0; i < u; i++) {
    Hash[(tem * b) % p] = i;
    tem = (tem * a) % p;
  }
  long long cur = tem;
  for (int i = 1; i <= u; i++) {
    if (Hash.find(cur) != Hash.end()) return i * u - Hash[cur];
    cur = (cur * tem) % p;
  }
  return -1;
}
int main() {
  int n, m, k, x;
  scanf("%d", &k);
  matrix c(k, 0);
  for (int i = 0; i < k; i++) {
    scanf("%d", &x);
    c.mat[0][i] = x % (mod - 1);
  }
  for (int i = 1; i < k; i++) c.mat[i][i - 1] = 1;
  scanf("%d%d", &n, &m);
  c = quick_pow(c, n - k);
  int ans = solve(c.mat[0][0], BSGS(g, m, mod), mod - 1);
  if (ans >= 0) {
    printf("%lld\n", quick_pow(g, ans, mod));
  } else
    printf("-1\n");
  return 0;
}
