#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, mp = mod - 1;
int k, n, m, g[105][105], f[105][105], tmp[105][105];
void mul(int ord) {
  if (ord) {
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= k; j++) tmp[i][j] = f[i][j], f[i][j] = 0;
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= k; j++)
        for (int o = 1; o <= k; o++)
          f[i][j] = (f[i][j] % mp + 1ll * tmp[i][o] * g[o][j] % mp) % mp;
  }
  if (!ord) {
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= k; j++) tmp[i][j] = g[i][j], g[i][j] = 0;
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= k; j++)
        for (int o = 1; o <= k; o++)
          g[i][j] = (g[i][j] % mp + 1ll * tmp[i][o] * tmp[o][j] % mp) % mp;
  }
}
int quickpow(int a, int b) {
  int s = 1;
  while (b) {
    if (b % 2) s = 1ll * s * a % mod;
    a = 1ll * a * a % mod, b /= 2;
  }
  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 = quickpow(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[i][1]), g[i][i + 1] = 1;
  g[k][k + 1] = 0;
  f[1][1] = 1;
  scanf("%d%d", &n, &m);
  n -= k;
  while (n) {
    if (n % 2) mul(1);
    mul(0);
    n /= 2;
  }
  int ans = BSGS(quickpow(3, f[1][1]), m, mod);
  printf("%d", ans == -1 ? ans : quickpow(3, ans));
}
