n = int(input()) a = list(map(int,input().split())) mod = 998244353 dp = [[0 for _ in range(2*10**4+2)] for _ in range(n+1)] dp[0][10**4] = 1 for i in range(n): for j in range(2*10**4+2): if 0 <= j-a[i] <= 2*10**4+1: dp[i+1][j] += dp[i][j-a[i]] if 0 <= j+a[i] <= 2*10**4+1: dp[i+1][j] += dp[i][j+a[i]] dp[i+1][j] %= mod ans = 0 st = 10**4 for i in range(2*10**4+2): num = (i-st)*dp[n][i] # if num != 0: # print(i,num) ans += abs((i-st))*dp[n][i] ans %= mod print(ans)