#include <bits/stdc++.h>

using namespace std;

const int MOD = 998244353;

int n, a[305];
long long dp[305][90005];

int main() {
	scanf("%d", &n);
	
	int s = 0;
	
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		s += a[i];
	}
	
	long long all = 1LL;
	for (int i = 0; i < n; i++) all = (all * 3) % MOD;
	
	dp[0][0] = 1LL;
	
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= s; j++) dp[i][j] = (dp[i][j] + dp[i - 1][j] * 2) % MOD;
		for (int j = a[i]; j <= s; j++) dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % MOD;
	}
	
	long long tmp = 0;
	
	for (int i = (s + 1) / 2; i <= s; i++) tmp = (tmp + dp[n][i]) % MOD;
	long long res = all - 3LL * tmp;
	res %= MOD; res += MOD; res %= MOD;
	
	memset(dp, 0, sizeof(dp));
	
	dp[0][0] = 1LL;
	
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= s; j++) dp[i][j] = (dp[i][j] + dp[i - 1][j]) % MOD;
		for (int j = a[i]; j <= s; j++) dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i]]) % MOD;
	}
	
	if (s % 2 == 0) {
		res += 3LL * dp[n][s / 2];
		res %= MOD;
	}
	
	printf("%lld\n", res);
}
