#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, mp = mod - 1, G = 3;
int K, n, m;
struct Mat {
  int s[105][105];
  Mat() { memset(s, 0, sizeof s); }
  Mat operator*(const Mat& B) {
    Mat ret;
    for (int k = 1; k <= K; k++)
      for (int i = 1; i <= K; i++)
        if (s[i][k])
          for (int j = 1; j <= K; j++)
            if (B.s[k][j])
              ret.s[i][j] = (ret.s[i][j] + 1ll * s[i][k] * B.s[k][j]) % mp;
    return ret;
  }
} f, g;
inline int ksm(int a, int b) {
  int s = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) s = 1ll * s * a % mod;
  return s;
}
int BSGS(int a, int b, const int p) {
  int m = int(sqrt(p) + 1);
  static map<int, int> has;
  has.clear();
  for (int i = 0, t = b; i < m; i++) has[t] = i, t = 1ll * t * a % p;
  int base = ksm(a, m), now = 1;
  for (int i = 1; i <= m + 1; i++)
    if (has.count(now = 1ll * now * base % p)) return i * m - has[now];
  return -1;
}
int main() {
  scanf("%d", &K);
  for (int i = 1; i <= K; i++)
    scanf("%d", &g.s[K - i + 1][K]), g.s[i + 1][i] = 1;
  f.s[1][K] = 1, g.s[K + 1][K] = 0;
  scanf("%d%d", &n, &m);
  for (n -= K; n; n >>= 1, g = g * g)
    if (n & 1) f = f * g;
  int ans = BSGS(ksm(G, f.s[1][K]), m, mod);
  printf("%d\n", ans == -1 ? -1 : ksm(G, ans));
}
