#include using namespace std; #include using mint = atcoder::modint998244353; template void fwt(std::vector &f) { int n = f.size(); for(int i = 1; i < n; i <<= 1) { for(int j = 0; j < n; j++) { if((j & i) == 0) { T x = f[j], y = f[j | i]; f[j] = x + y, f[j | i] = x - y; } } } } template void ifwt(std::vector &f) { int n = f.size(); const T tinv = T(1) / 2; for(int i = 1; i < n; i <<= 1) { for(int j = 0; j < n; j++) { if((j & i) == 0) { T x = f[j], y = f[j | i]; f[j] = (x + y) * tinv, f[j | i] = (x - y) * tinv; } } } } constexpr int sz = 1 << 11; mint res; int main() { int n; cin >> n; std::vector a(sz); for(int i = 0; i <= n; i++) cin >> a[i]; int sum = accumulate(a.begin(), a.end(), 0); vector f(sz); f[0] = 1; for(int i = 1; i < sz; i++) f[i] = -mint(a[i]) / sum; for(int x = 1; x < sz; x++) { auto g = f; g[x] = 0; fwt(g); for(int i = 0; i < sz; i++) g[i] = g[i].inv(); ifwt(g); res += g[x]; } res *= a[0]; res /= sum; cout << res.val() << endl; return 0; }