#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef pair<int,int> pii;

int N,a[310],S;
int f[2][90010];
int g[90010];
const int MOD = 998244353;

int main() {
	scanf("%d",&N);
	for (int i=1;i<=N;i++) {
		scanf("%d",&a[i]);
		S += a[i];
	}
	f[0][0] = 1;
	g[0] = 1;
	for (int i=1;i<=N;i++) {
		int now = i & 1, last = now ^ 1;
		for (int j=0;j<=S;j++) {
			f[now][j] = f[last][j] * 2 % MOD;
		}
		for (int j=a[i];j<=S;j++) {
			f[now][j] = (f[now][j] + f[last][j - a[i]]) % MOD;
		}
		for (int j=S;j>=a[i];j--) {
			g[j] = (g[j] + g[j - a[i]]) % MOD;
		}
		/*
		printf("%d:\n",i);
		for (int j=0;j<=S;j++) {
			printf("f[%d]=%d\n",j,f[now][j]);
		}
		*/
	}
	int ans = 0;
	for (int i=(S+1)/2;i<=S;i++) {
		ans = (ans + f[N & 1][i]) % MOD;
	}
	//printf("%d\n",g[S/2]);
	if (S % 2 == 0) {
		ans = (ans - g[S / 2] + MOD) % MOD;
	}
	int p3 = 1;
	for (int i=1;i<=N;i++) {
		p3 = p3 * 3LL % MOD;
	}
	ans = ((p3 - 3LL * ans) % MOD + MOD) % MOD;
	printf("%d\n",ans);
}