import itertools M = 998244353 n = int(input()) a = list(map(int, input().split())) a.reverse() print((sum(itertools.accumulate(a)) + sum(a)) * pow(2, n - 2, M) % M)