N = int(input()) A = list(map(int, input().split())) def func2(k): return (k*POW[k-1]+POW[k])%MOD def func(left, right): return func2(left)*func2(right)%MOD MOD = 998244353 POW = [1] for _ in range(N): POW.append(POW[-1]*2%MOD) ans = 0 for i in range(N): ans += A[i]*func(i, N-1-i)%MOD ans %= MOD print(ans)