def or_convolution(A, B): n = max(len(A), len(B)) X = [0] * (1 << (n - 1).bit_length()) for i, a in enumerate(A): for j, b in enumerate(B): X[i|j] += a * b return X def and_convolution(A, B): n = max(len(A), len(B)) X = [0] * (1 << (n - 1).bit_length()) for i, a in enumerate(A): for j, b in enumerate(B): X[i&j] += a * b return X def zeta_bit(L0): # 下からの累積 k = (len(L0) - 1).bit_length() n = 1 << k L = L0[:] + [0] * (n - len(L0)) for i in range(k): for j in range(n): if j >> i & 1: L[j] += L[j^(1<> i & 1: L[j] -= L[j^(1<> i & 1: L[j^(1<> i & 1: L[j^(1<> 1 x ^= x >> 2 x ^= x >> 4 x ^= x >> 8 x ^= x >> 16 return x & 1 def r(a): for i in range(1, 10001): if i and a * i % P <= 10000: return str(a*i%P) + "/" + str(i) if i and -a * i % P <= 10000: return str(-(-a*i%P)) + "/" + str(i) return a P = 998244353 N = int(input()) A = [int(a) for a in input().split()] S = sum(A) iS = pow(S, P - 2, P) A = [a * iS % P for a in A] B = zeta_bit(A) ans = 0 for i, b in enumerate(B[:-1]): if popcount_parity(i): ans += pow(B[-1] - b, P - 2, P) else: ans -= pow(B[-1] - b, P - 2, P) print(ans * (-1) ** N % P)