import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) ans = 0 MOD = 998244353 for i in range(N): if i==0: ans += pow(2, N-i-1, MOD)*a[i] else: ans += pow(2, i-1, MOD)*(i+2)*pow(2, N-i-1, MOD)*a[i] ans %= MOD print(ans)