N = int(input()) A = list(map(int, input().split())) mod = 998244353 if N == 1: print(A[0]) exit() ans = 0 cnt = pow(2, N - 1, mod) d = pow(2, N - 2, mod) print(cnt, d) for a in A: ans += a * cnt ans %= mod cnt += d cnt %= mod print(ans)