N = int(input()) a = list(map(int, input().split())) res = 0 mod = 998244353 for i in range(1,N+1): res += (a[i-1]*((i-1)*pow(2,max(0,i-2),mod)+pow(2,i-1,mod))*pow(2,N-i,mod))%mod res %= mod print(res)