"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), A = cin.getIntArray(N);
    let dp = new Array(301).fill(0).map(() => new Array(90000).fill(0));
    let dph = new Array(301).fill(0).map(() => new Array(90000).fill(0));
    const MOD = 998244353;
    const add = (a, b) => (a % MOD + b % MOD) % MOD;
    const div2 = (a) => Math.floor(a / 2);
    const div = (a, b) => Math.floor(a / b);
    let M = A.reduce((ac, v) => ac + v, 0);
    let harf = 0;
    if (M % 2 == 0) {
        dph[0][0] = 1;
        for (let i = 0; i < N; i++) {
            for (let j = 0; j < dph[0].length; j++) {
                if (dph[i][j] != 0) {
                    dph[i + 1][j] = add(dph[i + 1][j], dph[i][j]);
                    dph[i + 1][j + A[i]] = add(dph[i + 1][j + A[i]], dph[i][j]);
                }
            }
        }
        harf = dph[N][div2(M)];
    }
    M = div2(M - 1);
    dp[0][0] = 1;
    for (let i = 0; i < N; i++) {
        for (let j = 0; j < dp[0].length; j++) {
            if (dp[i][j] != 0) {
                dp[i + 1][j] = add(dp[i + 1][j], dp[i][j]);
                dp[i + 1][j] = add(dp[i + 1][j], dp[i][j]);
                dp[i + 1][j + A[i]] = add(dp[i + 1][j + A[i]], dp[i][j]);
            }
        }
    }
    let outcase = 0;
    for (let i = M + 1; i < dp[0].length; i++) {
        outcase += dp[N][i];
    }
    outcase = outcase - harf;
    if (outcase < 0) outcase += MOD;
    outcase = (outcase * 3) % MOD;
    let all = 1;
    for (let i = 0; i < N; i++) {
        all *= 3;
        all %= MOD;
    }
    let ans = all - outcase;
    if (ans < 0) ans += MOD;
    console.log(ans);
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));