#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

const int MOD = 998244353;

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(begin(a), end(a));
	
	int s = 0;
	for(auto v: a) s += v;
	
	auto dp = make_v<i64>(n + 1, s + 1); dp[0][0] = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < s; j++) {
			if(!dp[i][j]) continue;
			(dp[i + 1][j + a[i]] += dp[i][j]) %= MOD;
			(dp[i + 1][j] += dp[i][j]) %= MOD;
			(dp[i + 1][j] += dp[i][j]) %= MOD;
		}
	}
	
	i64 ans = 1;
	for(int i = 0; i < n; i++) (ans *= 3LL) %= MOD;
	
	i64 sub = 0;
	for(int i = (s + 1) / 2; i <= s; i++) (sub += dp[n][i]) %= MOD;
	
	if(!(s & 1)) {
		auto dp2 = make_v<i64>(n + 1, s + 1); dp2[0][0] = 1;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < s; j++) {
				if(!dp2[i][j]) continue;
				(dp2[i + 1][j + a[i]] += dp2[i][j]) %= MOD;
				(dp2[i + 1][j] += dp2[i][j]) %= MOD;
			}
		}
		
		(sub -= dp2[n][s / 2] - MOD) %= MOD;
	}
	printf("%lld\n", (ans - 3 * sub % MOD + MOD) % MOD);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define MOD 998244353

int n, a[330], dp[300*303], d2[300*303], ans = 1, sum;

int expo(int b, int e) {
    if(e == 0) return 1;
    if(e & 1) return 1ll * b * expo(1LL * b * b % MOD, e >> 1) % MOD;
    return expo(1LL * b * b % MOD, e >> 1);
}

int inv_mod(int x) { return expo(x, MOD - 2); }

int main() {
    scanf("%d", &n);

    dp[0] = d2[0] = 1;
    for(int i = 0; i < n; i++) {
        scanf("%d", &a[i]);

        sum += a[i];
        ans = 3LL * ans % MOD;

        for(int v = n * 300; v >= 0; v--) {
            dp[v] = (2LL * dp[v] % MOD + (v >= a[i] ? dp[v - a[i]] : 0)) % MOD;
            d2[v] =       (d2[v] % MOD + (v >= a[i] ? d2[v - a[i]] : 0)) % MOD;
        }
    }

    for(int i = sum; 2*i >= sum; i--)
        ans = (ans - 3LL * dp[i] % MOD + MOD) % MOD;

    if(sum % 2 == 0) ans = (ans + 3LL * d2[sum/2] % MOD) % MOD;

    printf("%d\n", ans);
    return 0;
}
