#include <bits/stdc++.h>
using namespace std;


const int MAXN = 312;
const int MAXV = (MAXN * MAXN);
const long long MOD = 998244353;

int n;
int s;
int v[MAXN];
long long memo[MAXN][MAXV];

long long solve (int x, int sum) {
	if (x == n) return (sum >= s - sum);

	long long & p = memo[x][sum];
	if (p + 1) return p;

	p = 0;
	p += solve (x + 1, sum + v[x]);
	p += 2LL * solve (x + 1, sum);
	
	while (p >= MOD) p -= MOD;

	return p;
}

long long solve2 (int x, int sum) {
	if (x == n) return (sum == s - sum);

	long long & p = memo[x][sum];
	if (p + 1) return p;

	p = 0;
	p += solve2 (x + 1, sum + v[x]);
	p += solve2 (x + 1, sum);
	
	while (p >= MOD) p -= MOD;

	return p;
}

int main () {

	cin >> n;

	long long p3 = 1;

	for (int i = 0; i < n; ++i) {
		scanf ("%d", v + i);
		s += v[i];
		p3 *= 3;
		p3 %= MOD;
	}

	memset (memo, -1LL, sizeof memo);
	long long ans = solve (0, 0);
	memset (memo, -1LL, sizeof memo);
	ans -= solve2 (0, 0);
	ans *= 3LL;
	ans %= MOD;
	ans = p3 - ans;
	while (ans < 0) ans += MOD;
	ans %= MOD;

	cout << ans << endl;

	return 0;
}