n=int(input()) a=list(map(int,input().split())) if(n>1): m=2**(n-2)%998244353 score=0 for i in range(n): score+=(i+2)*a[i] print(score*m%998244353) else: print(a[0]%998244353)