#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; i++)

typedef long long ll;
ll mod=998244353;
ll dp[310][90010];
ll dp2[310][90010];
int main()
{
	int n;
	int a[310];
	int sum=0;
	cin >> n;
	rep(i, n)
	{
		cin >> a[i];
		sum+=a[i];
	}
	ll beki=1;
	rep(i, n) beki=(beki*2)%mod;
	dp[0][0]=beki;
	ll inv=(mod+1)/2;
	rep(i, n)
	{
		rep(j, 90001) dp[i+1][j]=dp[i][j];
		rep(j, 90001-a[i]) dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+inv*dp[i][j])%mod;
	}
	dp2[0][0]=mod-2;
	rep(i, n)
	{
		rep(j, 90001) dp2[i+1][j]=dp2[i][j];
		rep(j, 90001-a[i]) dp2[i+1][j+a[i]]=(dp2[i+1][j+a[i]]+dp2[i][j])%mod;
	}
	ll tmp=0;
	rep(i, 90001)
	{
		if(2*i>=sum)
		{
			tmp=(tmp+dp[n][i])%mod;
			tmp=(tmp+dp2[n][i])%mod;
		}
	}
	tmp=(3*tmp)%mod;
	ll feki=1;
	rep(i, n) feki=(feki*3)%mod;
	ll ans=(3*mod+feki-3*beki+3)%mod;
	ans=(ans+mod-tmp)%mod;
	ans=(ans+mod-3)%mod;
	cout << ans << endl;
	return 0;
}