import java.io.*; import java.util.*; public class Main { static final int MOD = 998244353; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int base = n * 100; long[][] dp = new long[n + 1][base * 2 + 1]; dp[0][base] = 1; for (int i = 1; i <= n; i++) { int x = sc.nextInt(); for (int j = 0; j < dp[i].length; j++) { if (dp[i - 1][j] > 0) { dp[i][j + x] += dp[i - 1][j]; dp[i][j + x] %= MOD; dp[i][j - x] += dp[i - 1][j]; dp[i][j + x] %= MOD; } } } long ans = 0; for (int i = 0; i < dp[n].length; i++) { long value = Math.abs(i - base); ans += value * dp[n][i] % MOD; ans %= MOD; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }