MOD = 998244353 N = int(input()) A = [0]+list(map(int,input().split())) BASE = 10**4 dp = [[0 for _ in range(2*BASE+1)] for _ in range(N+1)] dp[1][A[1]+BASE] = 1 dp[1][-A[1]+BASE] = 1 for i in range(2,N+1): for j in range(2*BASE+1): if j-A[i]>=0: dp[i][j] = (dp[i][j]+dp[i-1][j-A[i]])%MOD if j+A[i]<=2*BASE: dp[i][j] = (dp[i][j]+dp[i-1][j+A[i]])%MOD ans = 0 for j in range(2*BASE+1): ans = (ans+dp[N][j]*abs(j-BASE))%MOD print(ans)