#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int x=0,f=1;
	char ch;
	do
	{
		ch=getchar();
		if (ch=='-')
		{
			f=-f;
		}
	}while (ch<'0' || ch>'9');
	do
	{
		x=x*10+ch-'0';
		ch=getchar();
	}while (ch>='0' && ch<='9');
	return x*f;
}
#define ll long long
const ll Mod=998244353;
const int maxn=310;
int n,a[maxn],s;
ll f[maxn][maxn*maxn/2],g[maxn][maxn*maxn/2];
void upd(ll &x,ll v)
{
	x=(x+v)%Mod;
}
ll pw(ll x,ll y)
{
	ll res=1;
	while (y)
	{
		if (y&1)
		{
			res=res*x%Mod;
		}
		x=x*x%Mod;
		y>>=1;
	}
	return res;
}
int main()
{
	n=read();
	for (int i=1;i<=n;i++)
	{
		a[i]=read();
		s+=a[i];
	}
	int m=s/2;
	f[0][0]=1;
	g[0][0]=1;
	for (int i=1;i<=n;i++)
	{
		for (int j=0;j<=m;j++)
		{
			upd(f[i][j],f[i-1][j]);
			upd(g[i][j],g[i-1][j]);
			if (j>=a[i])
			{
				upd(f[i][j],f[i-1][j-a[i]]*2);
				upd(g[i][j],g[i-1][j-a[i]]);
			}
		}
	}
	ll ans=0;
	for (int i=0;i<=m;i++)
	{
		upd(ans,f[n][i]);
	}
	if (s%2==0)
	{
		ans=(ans-g[n][m]+Mod)%Mod;
	}
	ans=ans*3%Mod;
	ans=(pw(3,n)-ans+Mod)%Mod;
	cout<<ans<<endl;
	return 0;
}