N = int(input()) A = list(map(int, input().split())) MOD = 998244353 pow2 = [1]*N for i in range(1, N): pow2[i] = pow2[i-1] * 2 % MOD ans = 0 for i, a in enumerate(A, 1): l = (pow2[i-1] + (i-1)*pow2[i-2]) % MOD r = ((N-i)*pow2[N-i-1] + pow2[N-i]) % MOD ans += a * l * r % MOD print(ans % MOD)