N = int(input()) A = list(map(int, input().split())) MOD = 998244353 total = 1 two = 1 goal = pow(2, N-2, MOD) div = pow(2, MOD-2, MOD) score = 0 for i, a in enumerate(A, start=1): score += total * a * goal score %= MOD if goal != 1: goal *= div goal %= MOD total += two+total total %= MOD two *= 2 two %= MOD print(score)