mod = 998244353 n = int(input()) ans = 0 sm_i = 0 cnt = 1 for i, x in enumerate(map(int, input().split())): c = cnt s = sm_i + cnt if i == n - 1: ans = (ans + s * x) % mod else: ans = (ans + s * x * pow(2, n - 2 - i, mod)) % mod cnt = (c + cnt) % mod sm_i = (sm_i + s) % mod print(ans)