n=gets.to_i M=998244353 i=0 p gets.split.sum{2.pow(n,M)*_1.to_i/4*-~i+=1}%M