mod=998244353 def cmb(n,r): if r<0 or r>n: return 0 return ((g1[n]*g2[r]%mod)*g2[n-r])%mod N=300000 g1=[1]*(N+3) for i in range(2,N+3): g1[i]=g1[i-1]*i%mod g2=[0]*len(g1) g2[-1]=pow(g1[-1],mod-2,mod) for i in range(N+1,-1,-1): g2[i]=g2[i+1]*(i+1)%mod inv=[0]*(N+3) for i in range(1,N+3): inv[i]=g2[i]*g1[i-1]%mod N=int(input()) A=list(map(int,input().split())) mod=998244353 MOD=999630629 S=sum(A) if SK: continue z[r]=(z.get(r,0)+x[p]*y[q])%mod return z K=S-MOD for i in range(10000): if C[i]==0: continue v=dict() for j in range(C[i],-1,-1): p=(10000-i)*(C[i]-j) if p>K: break v[p]=(v.get(p,0)+cmb(C[i],j))%mod X=f(X,v) print((pow(2,N-1,mod)*S-sum(X)*(MOD-mod))%mod)