#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using v2d = vector<vector<T>>;
template <class T>
using v3d = vector<vector<vector<T>>>;
template <class T>
using v4d = vector<vector<vector<vector<T>>>>;
template <class T>
using prq = priority_queue<T>;
template <class T>
using rpq = priority_queue<T, vector<T>, greater<T>>;
using Mat = v2d<ll>;
using Row = vec<ll>;
const int MOD = 998244353;
const int MOD_E = MOD - 1;
const int ROOT = 3;
const Mat ID = {{-1}};
Mat operator*(const Mat& a, const Mat& b) {
  if (b == ID) {
    return a;
  }
  assert(a[0].size() == b.size());
  int y = a.size(), x = b[0].size(), n = a[0].size();
  Mat c(y, Row(x));
  for (int i = 0; i < y; ++i) {
    for (int k = 0; k < n; ++k) {
      for (int j = 0; j < x; ++j) {
        c[i][j] = (c[i][j] + (a[i][k] * b[k][j]) % MOD_E) % MOD_E;
      }
    }
  }
  return c;
}
Mat pow(const Mat& x, int expo) {
  if (expo == 0) {
    return ID;
  }
  if (expo & 1) {
    return x * pow(x, expo - 1);
  }
  Mat temp = pow(x, expo / 2);
  return temp * temp;
}
ll mpow(ll n, ll k) {
  if (k == 0) {
    return 1;
  }
  if (k & 1) {
    return (n * mpow(n, k - 1)) % MOD;
  }
  ll temp = mpow(n, k / 2);
  return (temp * temp) % MOD;
}
int bsgs(int a, int b) {
  const int N = sqrt(MOD);
  map<int, int> res;
  for (int i = 1; i <= N; ++i) {
    res[mpow(a, N * i)] = i;
  }
  for (int i = 0; i <= N; ++i) {
    int cur = (b * mpow(a, i)) % MOD;
    auto ptr = res.find(cur);
    if (ptr != res.end()) {
      return ptr->second * N - i;
    }
  }
  return -1;
}
int solve(int k, int a) {
  int res = bsgs(mpow(ROOT, k), a);
  if (res == -1) {
    return -1;
  }
  return mpow(ROOT, res);
}
int main() {
  int k;
  scanf("%d", &k);
  vec<int> b(k);
  for (auto& i : b) {
    scanf("%d", &i);
  }
  int n, m;
  scanf("%d %d", &n, &m);
  Mat tr(k, Row(k));
  for (int i = 0; i < k; ++i) {
    tr[0][i] = b[i];
  }
  for (int i = 1; i < k; ++i) {
    tr[i][i - 1] = 1;
  }
  Mat base(1, Row(k));
  base[0][0] = 1;
  int times = n - k;
  auto res = base * pow(tr, times);
  printf("%d\n", solve(res[0][0], m));
}
