#include constexpr int mod = 998244353; int main() { int N; std::cin >> N; std::vector B(N); B[0] = 1; for (int i = 1; i < N; i++) { std::cin >> B[i]; B[i] *= B[i - 1]; if (B[i] > 1000000) std::abort(); } std::string M_; std::cin >> M_; if (M_.size() >= 8) std::abort(); const int M = std::stoi(M_); std::vector dp(M + 1, 0); dp[0] = 1; for (const int e : B) { for (int i = e; i <= M; i++) { dp[i] += dp[i - e]; dp[i] %= mod; } } std::cout << dp[M] << "\n"; return 0; }