using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; var mod = 998_244_353; var dp = new long[20001]; dp[10000] = 1; for (var i = 0; i < n; ++i) { var ndp = new long[20001]; for (var j = 0; j < dp.Length; ++j) { if (j - a[i] >= 0) ndp[j - a[i]] = (ndp[j - a[i]] + dp[j]) % mod; if (j + a[i] < ndp.Length) ndp[j + a[i]] = (ndp[j + a[i]] + dp[j]) % mod; } dp = ndp; } var ans = 0L; for (var i = 0; i < dp.Length; ++i) ans = (ans + Math.Abs(i - 10000) * dp[i] % mod) % mod; WriteLine(ans); } }