dp = [[0] * 60000 for _ in range(110)] dp[0][0] = 1 n = int(input()) a = list(map(int,input().split())) mod = 998244353 for i in range(n): for j in range(-10010, 10010): dp[i + 1][j + a[i]] += dp[i][j] dp[i + 1][j - a[i]] += dp[i][j] dp[i + 1][j] %= mod ans = 0 for j in range(-10010, 10010): ans += abs(j) * dp[n][j] ans %= mod print(ans)