#include<iostream>
#include<math.h>
using namespace std;

long int MOD = 998244353;
long long int dp[300][90001], sum = 0, ans = 0;
long long powmod(long long a, long long b) {
	a %= MOD;
	long long res = 1;
	while (b > 0) {
		if (b % 2 == 1)res = res * a % MOD;
		a = a * a % MOD;
		b /= 2;
	}
	return res;
}
int main() {
	int N, A[300], i, j;


	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> A[i];
		sum += A[i];
	}
	for (i = 0; i < 90001; i++)dp[0][i] = (long long)0;
	dp[0][0] = (long long)2;
	dp[0][A[0]] = (long long)1;
	for (i = 1; i < N; i++) {
		for (j = 0; j < 90001; j++) {
			dp[i][j] = dp[i - 1][j] * 2;
			if (A[i] <= j)dp[i][j] += dp[i - 1][j - A[i]];
			dp[i][j] %= MOD;
		}
	}
	for (i = (sum + 1) / 2; i < 90001; i++) {
		ans += dp[N - 1][i];
		ans %= MOD;
	}
	for (i = 0; i < 90001; i++)dp[0][i] = 0;
	dp[0][0] = 1;
	dp[0][A[0]] = 1;
	for (i = 1; i < N; i++) {
		for (j = 0; j < 90001; j++) {
			dp[i][j] = dp[i - 1][j];
			if (A[i] <= j)dp[i][j] += dp[i - 1][j - A[i]];
			dp[i][j] %= MOD;
		}
	}
	if (sum % 2 == 0)ans -= dp[N - 1][sum / 2];
	printf("%lld", (((long long)powmod(3.0, N - 1) - ans + MOD) * 3) % MOD);
}
