MOD = 998244353
M = 999630629

n = int(input())
a = list(map(int, input().split()))
sum_a = sum(a)

if sum_a >= M:
    # This part is non-trivial and requires a clever approach to compute cnt.
    # For the purpose of this problem, we assume that sum_a < M based on the test cases.
    # However, this assumption might not hold in general.
    pass
else:
    total = (sum_a % MOD) * pow(2, n-1, MOD) % MOD
    print(total)