N = int(input()) A = list(map(int,input().split())) mod = 998244353 dp = [[0]*N for _ in range(10200)] dp[A[0]][0] = 2 for i in range(N-1): a = A[i+1] for j in range(10001): dp[abs(j-a)][i+1] += dp[j][i] dp[abs(j+a)][i+1] += dp[j][i] for j in range(10200): dp[j][i+1] %= mod ans = 0 for i in range(1,10001): ans += i*dp[i][N-1] ans %= mod print(ans)