#include<bits/stdc++.h>
#define LL long long
#define DB long double
using namespace std;
#define P 998244353
inline int ad(int x,int y){return (x+y>=P)?(x+y-P):(x+y);}
inline int mt(int x,int y){return 1ll*x*y%P;}
inline void mo(int &x){x=(x>=P)?(x-P):x; x=(x<0)?(x+P):x;}
template<typename T>inline void ckmx(T &x,T y){x=max(x,y);}
template<typename T>inline void ckmi(T &x,T y){x=min(x,y);}
template<typename T>void read(T &x){
	x=0;int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if (c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-48;
	x*=f;
}
int n;
int a[310];
int f[310][90010]; 
int g[310][90010];
int po(int x,int k){
	int rt=1;
	while(k){
		if(k&1) rt=mt(rt,x);
		x=mt(x,x);
		k>>=1;
	}
	return rt;
}
int main(){
	read(n);
	int s=0;
	for(int i=1;i<=n;++i)
		read(a[i]),s+=a[i];
	f[0][0]=1;
	for(int i=1;i<=n;++i)
		for(int j=0;j<=s;++j)
			mo(f[i][j+a[i]]+=f[i-1][j]),mo(f[i][j]+=ad(f[i-1][j],f[i-1][j]));
	int ans=0;
	for(int j=(s+1)/2;j<=s;++j)
		mo(ans+=f[n][j]);
	ans=mt(ans,3);
	if(!(s&1)){
		g[0][0]=1;
		for(int i=1;i<=n;++i)
			for(int j=0;j<=s;++j)
				mo(g[i][j+a[i]]+=g[i-1][j]),mo(g[i][j]+=g[i-1][j]);	
		mo(ans-=mt(g[n][s/2],3));
	}
	mo(ans=po(3,n)-ans);
	cout<<ans<<endl;
	return 0;
}
