import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n = I() a = LI() sum = 0 MOD = 998244353 if n == 1: print(a[0]%MOD) else: for i in range(n): sum += a[i]*(2**(n-1)+2**(n-2)*i)%MOD sum %= MOD print(sum)