import sys input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) mod = 998244353 mx = max(a) m = mx * N ln = mx * N * 2 + 1 dp = [0] * ln dp[m] = 1 for x in a: dp2 = [0] * ln for i in range(ln): if i - x in range(ln): dp2[i - x] += dp[i] dp2[i - x] %= mod if i + x in range(ln): dp2[i + x] += dp[i] dp2[i + x] %= mod dp = dp2[: ] res = 0 for i in range(ln): x = i - m res += abs(x * dp[i]) res %= mod print(res)