n=int(input()) a=list(map(int,input().split())) M=998244353 L=10000 q=[0]*(L*2+1) q[0]=1 for v in a: nq=[0]*(L*2+1) for i in range(-L,L+1): if q[i]: nq[i+v]+=q[i] nq[i-v]+=q[i] for i in range(-L,L+1): nq[i]%=M q=nq print(sum(abs(i)*q[i]%M for i in range(-L,L+1))%M)