import sys input = sys.stdin.readline mod = 998244353 N = int(input()) A = list(map(int, input().split())) dp = [0] * (100*N+1) dp[0] = 1 for a in A: ndp = [0] * (100*N+1) for i in range(100*N+1): if i + a <= 100*N: ndp[i+a] = (ndp[i+a] + dp[i]) % mod ndp[abs(i-a)] = (ndp[abs(i-a)] + dp[i]) % mod dp = ndp ans = 0 for i in range(100*N+1): ans = (ans + dp[i] * i) % mod print(ans)