#include <bits/stdc++.h>

const int MAXN = 310;
const int MAXV = 90010;
const int mod = 998244353;

int n;
int a[MAXN];
int dp[MAXN][MAXV], f[MAXV];

int powmod(int a, int b) {
    int ret = 1;
    for (; b; b >>= 1) {
        if (b & 1) ret = 1ll * ret * a % mod;
        a = 1ll * a * a % mod;
    }
    return ret;
}

void add(int &a, int b) {
    a = (a + b) % mod;
}

int main() {
    scanf("%d", &n);
    int S = 0;
    for (int i = 1; i <= n; ++i) {
        scanf("%d", a + i);
        S += a[i];
    }
    int ans = 0;
    dp[0][0] = f[0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= S; ++j) {
            // to max len
            if (j + a[i] <= S) {
                add(dp[i][j + a[i]], dp[i - 1][j]);
            }
            add(dp[i][j], dp[i - 1][j] * 2 % mod);
        }
        for (int j = S; ~j; --j) {
            if (j + a[i] <= S) {
                add(f[j + a[i]], f[j]);
            }
        }
    }
    for (int j = 0; j <= S; ++j) {
        if (j * 2 < S) continue;
        add(ans, dp[n][j] * 3ll % mod);
    }
    if (S % 2 == 0) {
        ans = ((1ll * ans - 3ll * f[S >> 1]) % mod + mod) % mod;
    }
    printf("%d\n", ((powmod(3, n) - ans) % mod + mod) % mod);
    return 0;
}
