n=int(input()) a=list(map(int,input().split())) a.sort(reverse=True) mod=998244353 ans=pow(2,n-1,mod)*sum(a)%mod p=999630629 k=sum(a)-p if k>=0: dp=[0]*(k+1) dp[0]=1 newdp=[0]*(k+1) ch=set() ch.add(0) for x in a: newch=set() for s in ch: newdp[s]+=dp[s] newdp[s]%=mod newch.add(s) if s+x<=k: newdp[s+x]+=dp[s] newdp[s+x]%=mod newch.add(s+x) for s in ch:dp[s]=0 dp,newdp=newdp,dp ch=newch ans-=p*sum(dp) print(ans%mod)