MOD = 998244353 P = 999630629 def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) sum_A = sum(A) exponent = pow(2, N-1, MOD) sum_s = (sum_A % MOD) * exponent % MOD # Compute count, the number of subsets with sum >= P # This part is left as a placeholder since the correct approach isn't clear # For the purpose of this example, we assume count = 0 count = 0 # S_total = sum_s - P * count mod MOD P_mod = P % MOD term = (P_mod * count) % MOD S_total = (sum_s - term) % MOD print(S_total) if __name__ == "__main__": main()