using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; namespace yukicoder { class Program { const int intMax = 1000000000; const long longMax = 2000000000000000000; static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); var dp = new Dictionary(); long mod = 998244353; dp[0] = 1; for(int i = 0; i < N; i++) { var temp = new Dictionary(); foreach(var d in dp) { if(!temp.ContainsKey(d.Key + A[i])) { temp.Add(d.Key + A[i],0); } if(!temp.ContainsKey(d.Key - A[i])) { temp.Add(d.Key - A[i],0); } temp[d.Key + A[i]] = (temp[d.Key + A[i]] + d.Value) % mod; temp[d.Key - A[i]] = (temp[d.Key - A[i]] + d.Value) % mod; } dp = temp; } long ans = 0; foreach(var d in dp) { ans = (ans + (Math.Abs(d.Key) * d.Value) % mod ) % mod; } Console.WriteLine(ans); } } }