#include <algorithm>
#include <iostream>
#include <cstdio>
#define N 402
using namespace std;
typedef long long ll;
const int Mod = 998244353;

inline ll fsp(ll x, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) (res *= x) %= Mod;
        (x *= x) %= Mod;
        p >>= 1;
    }
    return res;
}

int n, a[N];
ll sum[N], f[N][N * N], g[N][N * N];

int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%d", a + i), sum[i] = sum[i - 1] + a[i];
    f[0][0] = 1, g[0][0] = 1;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j <= sum[n]; ++j) {
            f[i + 1][j] += f[i][j] * 2 % Mod;
            g[i + 1][j] += g[i][j];
            (f[i + 1][j + a[i + 1]] += f[i][j]) %= Mod,
            (g[i + 1][j + a[i + 1]] += g[i][j]) %= Mod;
        }
    ll ans = (fsp(3, n) - 3 * fsp(2, n) % Mod) % Mod;
    for (int j = (sum[n] + 1) / 2; j <= sum[n]; ++j)
        (ans -= (f[n][j] - 2 * g[n][j]) * 3) %= Mod;
    cout << (ans % Mod + Mod) % Mod;
    return 0;
}
