#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
#define N 305

const LL mod=998244353;
LL n,sum,ans,a[N],f[N][N*N];

void upd(LL &x,LL y){x=(x+y%mod+mod)%mod;}

int main(){
	scanf("%lld",&n);
	for (LL i=1;i<=n;++i){scanf("%lld",a+i); sum+=a[i];}
	ans=1; for (LL i=1;i<=n;++i) ans=ans*3%mod;
	f[0][0]=1;
	for (LL i=1;i<=n;++i)
		for (LL j=0;j<=i*300;++j){
			upd(f[i][j],f[i-1][j]*2);
			upd(f[i][j+a[i]],f[i-1][j]);
		}
	for (LL i=(sum+1)/2;i<=n*300;++i) upd(ans,-f[n][i]*3);
	if (sum%2==0){
		memset(f,0,sizeof f);
		f[0][0]=1;
		for (LL i=1;i<=n;++i)
			for (LL j=0;j<=i*300;++j){
				upd(f[i][j],f[i-1][j]);
				upd(f[i][j+a[i]],f[i-1][j]);
			}
		upd(ans,f[n][sum/2]*3);
	}
	printf("%lld\n",ans);
	
	return 0;
}
			