import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } sc.close(); int mod = 998244353; Map map = new HashMap<>(); map.put(0, 1L); for (int i = 0; i < n; i++) { Map wk = new HashMap<>(); for (Integer k : map.keySet()) { int next = k + a[i]; wk.put(next, wk.getOrDefault(next, 0L) + map.get(k)); next = k - a[i]; wk.put(next, wk.getOrDefault(next, 0L) + map.get(k)); } map = wk; } long ans = 0; for (Integer k : map.keySet()) { long v = map.get(k) % mod; long val = Math.abs(k) * v % mod; ans += val; } ans %= mod; System.out.println(ans); } }