#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    vector<int> a(n + 1);
    int all = 1;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        all = all * 3ll % mod;
    }
    vector<int> dp(n * 300 + 1);
    vector<int> cdp(n * 300 + 1);
    dp[0] = 1;
    cdp[0] = 1;
    int s = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = s; j >= 0; j--) {
            dp[j + a[i]] += dp[j];
            cdp[j + a[i]] += cdp[j];
            dp[j] = dp[j] * 2ll % mod;
            if (dp[j + a[i]] >= mod) {
                dp[j + a[i]] -= mod;
            }
            if (cdp[j + a[i]] >= mod) {
                cdp[j + a[i]] -= mod;
            }
        }
        s += a[i];
    }

    int lim = s / 2 + s % 2;

    for (int i = lim; i <= s; i++) {
        all -= 3ll * dp[i] % mod;
        if (all < 0) {
            all += mod;
        }
        if (i * 2 == s) {
            all += 3ll * cdp[i] % mod;
            if (all >= mod) {
                all -= mod;
            }
        }
    }
    cout << all << "\n";
    return 0;
}