import sys def I(): return int(sys.stdin.readline().rstrip()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def popcount(n): c = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555) c = (c & 0x3333333333333333) + ((c >> 2) & 0x3333333333333333) c = (c & 0x0f0f0f0f0f0f0f0f) + ((c >> 4) & 0x0f0f0f0f0f0f0f0f) c = (c & 0x00ff00ff00ff00ff) + ((c >> 8) & 0x00ff00ff00ff00ff) c = (c & 0x0000ffff0000ffff) + ((c >> 16) & 0x0000ffff0000ffff) c = (c & 0x00000000ffffffff) + ((c >> 32) & 0x00000000ffffffff) return c N = I() A = LI() s = sum(A) mod = 998244353 dp = A for i in range(1,N+1): for j in range(1<<N): if (1<<(i-1))&j: dp[j] += dp[j&~(1<<(i-1))] ans = 0 for i in range(1,1<<N): x = popcount(i) y = ((1<<N)-1)^i a = s*pow(s-dp[y],mod-2,mod) if x % 2: ans += a else: ans -= a ans %= mod print(ans)