Problem: Lunar New Year is approaching, and Bob received a gift from his friend recently — a recursive sequence! He loves this sequence very much and wants to play with it.

Let f_1, f_2, …, f_i, … be an infinite sequence of positive integers. Bob knows that for i > k, f_i can be obtained by the following recursive equation:

$$$f_i = \left(f_{i - 1} ^ {b_1} ⋅ f_{i - 2} ^ {b_2} ⋅ ⋅⋅⋅ ⋅ f_{i - k} ^ {b_k}\right) mod p,$$$

which in short is

$$$f_i = \left(∏_{j = 1}^{k} f_{i - j}^{b_j}\right) mod p,$$$

where p = 998 244 353 (a widely-used prime), b_1, b_2, …, b_k are known integer constants, and x mod y denotes the remainder of x divided by y.

Bob lost the values of f_1, f_2, …, f_k, which is extremely troublesome – these are the basis of the sequence! Luckily, Bob remembers the first k - 1 elements of the sequence: f_1 = f_2 = … = f_{k - 1} = 1 and the n-th element: f_n = m. Please find any possible value of f_k. If no solution exists, just tell Bob that it is impossible to recover his favorite sequence, regardless of Bob's sadness.

Input

The first line contains a positive integer k (1 ≤ k ≤ 100), denoting the length of the sequence b_1, b_2, …, b_k.

The second line contains k positive integers b_1, b_2, …, b_k (1 ≤ b_i < p).

The third line contains two positive integers n and m (k < n ≤ 10^9, 1 ≤ m < p), which implies f_n = m.

Output

Output a possible value of f_k, where f_k is a positive integer satisfying 1 ≤ f_k < p. If there are multiple answers, print any of them. If no such f_k makes f_n = m, output -1 instead.

It is easy to show that if there are some possible values of f_k, there must be at least one satisfying 1 ≤ f_k < p.

Examples

Input


3
2 3 5
4 16


Output


4


Input


5
4 7 1 5 6
7 14187219


Output


6


Input


8
2 3 5 6 1 7 9 10
23333 1


Output


1


Input


1
2
88888 66666


Output


-1


Input


3
998244352 998244352 998244352
4 2


Output


-1


Input


10
283 463 213 777 346 201 463 283 102 999
2333333 6263423


Output


382480067

Note

In the first sample, we have f_4 = f_3^2 ⋅ f_2^3 ⋅ f_1^5. Therefore, applying f_3 = 4, we have f_4 = 16. Note that there can be multiple answers.

In the third sample, applying f_7 = 1 makes f_{23333} = 1.

In the fourth sample, no such f_1 makes f_{88888} = 66666. Therefore, we output -1 instead.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
template <typename T>
void MACRO_VAR_Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First& first, Rest&... rest) {
  std::cin >> first;
  MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T& t) {
  t.resize(n);
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Init(int n, First& first, Rest&... rest) {
  first.resize(n);
  MACRO_VEC_ROW_Init(n, rest...);
}
template <typename T>
void MACRO_VEC_ROW_Scan(int p, T& t) {
  std::cin >> t[p];
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Scan(int p, First& first, Rest&... rest) {
  std::cin >> first[p];
  MACRO_VEC_ROW_Scan(p, rest...);
}
template <class T>
inline T CHMAX(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline T CHMIN(T& a, const T b) {
  return a = (a > b) ? b : a;
}
template <class T>
using V = std::vector<T>;
template <class T>
using VV = V<V<T>>;
template <typename S, typename T>
std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<ll, ll>;
using PAIRLL = std::pair<ll, ll>;
constexpr ll INFINT = 1 << 30;
constexpr ll INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);
constexpr double EPS = 1e-6;
constexpr ll MOD = 998244353;
constexpr ll MOD_ = MOD - 1;
constexpr double PI = 3.141592653589793238462643383279;
template <class T, size_t N>
void FILL(T (&a)[N], const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, size_t N, size_t M, class T>
void FILL(ARY (&a)[N][M], const T& val) {
  for (auto& b : a) FILL(b, val);
}
template <class T>
void FILL(std::vector<T>& a, const T& val) {
  for (auto& x : a) x = val;
}
template <class ARY, class T>
void FILL(std::vector<std::vector<ARY>>& a, const T& val) {
  for (auto& b : a) FILL(b, val);
}
template <class T>
class MatrixMOD {
 private:
  std::valarray<std::valarray<T>> mat;

 public:
  MatrixMOD(size_t m = 0, size_t n = 0, T init = 0) {
    if (n == 0) n = m;
    mat.resize(m);
    for (size_t i = 0; i < m; ++i) mat[i].resize(n, init);
  }
  MatrixMOD(std::valarray<std::valarray<T>> a) { mat = a; }
  MatrixMOD<T> init(size_t m = 0, size_t n = 0, T init = 0) {
    if (n == 0) n = m;
    mat.resize(m);
    for (size_t i = 0; i < m; ++i) mat[i].resize(n, init);
    return *this;
  }
  std::valarray<T>& operator[](size_t i) { return mat[i]; }
  const std::valarray<T>& operator[](size_t i) const { return mat[i]; }
  MatrixMOD<T>& operator=(const MatrixMOD<T>& r) {
    for (size_t i = 0; i < mat.size(); ++i) mat[i] = r[i];
    return *this;
  }
  MatrixMOD<T> operator+() const { return mat; }
  MatrixMOD<T> operator-() const {
    MatrixMOD<T> res(mat.size());
    for (size_t i = 0; i < mat.size(); ++i) res[i] = (MOD_ - mat[i]) %= MOD_;
    return res;
  }
  MatrixMOD<T>& operator+=(const MatrixMOD<T>& r) {
    for (size_t i = 0; i < mat.size(); ++i) (mat[i] += r[i]) %= MOD_;
    return *this;
  }
  MatrixMOD<T>& operator+=(const T& x) {
    for (size_t i = 0; i < mat.size(); ++i) (mat[i] += x) %= MOD_;
    return *this;
  }
  MatrixMOD<T>& operator-=(const MatrixMOD<T>& r) { return *this += MOD_ - r; }
  MatrixMOD<T>& operator-=(const T& x) { return *this += MOD_ - x; }
  MatrixMOD<T>& operator*=(const MatrixMOD<T>& r) {
    MatrixMOD<T> res(*this);
    for (size_t i = 0; i < mat.size(); ++i) {
      for (size_t j = 0; j < r[0].size(); ++j) {
        res[i][j] = 0;
        for (size_t k = 0; k < mat[0].size(); ++k) {
          (res[i][j] += mat[i][k] * r[k][j] % MOD_) %= MOD_;
        }
      }
    }
    return *this = res;
  }
  MatrixMOD<T>& operator*=(const T& x) {
    for (size_t i = 0; i < mat.size(); ++i) (mat[i] *= x) %= MOD_;
    return *this;
  }
  MatrixMOD<T>& operator%=(const T& mod) {
    for (size_t i = 0; i < mat.size(); ++i) mat[i] %= MOD_;
    return *this;
  }
  MatrixMOD<T>& operator^=(ll p) {
    MatrixMOD<T> res(*this);
    for (size_t i = 0; i < mat.size(); ++i) {
      for (size_t j = 0; j < mat[0].size(); ++j) {
        res[i][j] = i == j;
      }
    }
    while (p) {
      if (p & 1) (res *= (*this)) %= MOD_;
      ((*this) *= (*this)) %= MOD_;
      p >>= 1;
    }
    for (size_t i = 0; i < mat.size(); ++i) mat[i] = res[i];
    return *this;
  }
  MatrixMOD<T> operator+(const MatrixMOD& r) const {
    MatrixMOD<T> res(mat);
    return res += r;
  }
  MatrixMOD<T> operator-(const MatrixMOD& r) const {
    MatrixMOD<T> res(mat);
    return res -= r;
  }
  MatrixMOD<T> operator*(const MatrixMOD& r) const {
    MatrixMOD<T> res(mat);
    return res *= r;
  }
  MatrixMOD<T> operator*(const T& r) const {
    MatrixMOD<T> res(mat);
    return res *= r;
  }
  MatrixMOD<T> operator^(const ll& p) const {
    MatrixMOD<T> res(mat);
    return res ^= p;
  }
  MatrixMOD<T> t() const {
    MatrixMOD<T> res(mat[0].size(), mat.size(), 0);
    for (size_t i = 0; i < mat[0].size(); ++i) {
      for (size_t j = 0; j < mat.size(); ++j) {
        res[i][j] = mat[j][i];
      }
    }
    return res;
  }
  static MatrixMOD<T> getUnit(size_t n) {
    MatrixMOD<T> res(n, n, 0);
    for (size_t i = 0; i < n; ++i) res[i][i] = 1;
    return res;
  }
  void show() const {
    for (const auto& r : mat) {
      for (const auto& x : r) {
        std::cerr << x << "\t";
      }
      std::cerr << std::endl;
    }
  }
};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll modinv(ll a, ll b = MOD_, ll x = 1, ll y = 0) {
  if (b == 0) return x < 0 ? x + MOD_ : x;
  return modinv(b, a - a / b * b, y, x - a / b * y);
}
ll powMod(ll n, ll p, ll mod) {
  ll res = 1;
  while (p) {
    if (p & 1) (res *= n) %= mod;
    (n *= n) %= mod;
    p >>= 1;
  }
  return res;
}
ll BabyStepGiantStep(ll p, ll g, ll y) {
  ll m = std::ceil(std::sqrt(p));
  std::map<ll, ll> map;
  ll gj = 1;
  for (ll j = 0; j < m; ++j) {
    map[gj] = j;
    (gj *= g) %= p;
  }
  ll gm = powMod(g, p - 1 - m, p);
  ll ga = y;
  for (ll i = 0; i < m; ++i) {
    auto it = map.find(ga);
    if (it != map.end()) return i * m + it->second;
    (ga *= gm) %= p;
  }
  return -1;
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  ll k;
  MACRO_VAR_Scan(k);
  ;
  std::vector<ll> b(k);
  for (auto& i : b) std::cin >> i;
  ;
  ll n, m;
  MACRO_VAR_Scan(n, m);
  ;
  MatrixMOD<ll> A(k, k);
  for (ll i = 0; i < ll(k - 1); ++i) A[i][i + 1] = 1;
  for (ll i = 0; i < ll(k); ++i) A[k - 1][i] = b[k - i - 1];
  A ^= n - k;
  ll t = A[k - 1][k - 1];
  ll s = BabyStepGiantStep(MOD, 3, m);
  ll d = gcd(t, MOD_);
  if (s % d != 0) {
    std::cout << (-1);
    std::cout << "\n";
    ;
    return 0;
  }
  ll x = BabyStepGiantStep(MOD, powMod(3, t, MOD), m);
  std::cout << (powMod(3, x, MOD));
  std::cout << "\n";
  ;
  return 0;
}