#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define jizz ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define ET cout << "\n"
#define MEM(i,j) memset(i,j,sizeof i)
#define ALL(v) v.begin(),v.end()
#define DB(a,s,e) {for(int i=s;i<e;++i) cerr << a[i] << " ";ET;}
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const ll MOD=998244353;
ll dp[90005],dp2[90005];

int main()
{jizz
	ll n,ans=1,sum=0,x,t=1;
	cin >> n,dp[0]=1,dp2[0]=1;
	while(n--)
	{
		cin >> x,ans=ans*3%MOD,t=t*2%MOD,sum+=x;
		for(int i=sum;i>=x;--i)
			dp[i]=(dp[i]+dp[i-x])%MOD,dp2[i]=(dp2[i]*2+dp2[i-x])%MOD;
		for(int i=x-1;i>=0;--i)
			dp2[i]=dp2[i]*2%MOD;
	}
	for(int i=sum/2+(sum&1);i<=sum;++i)
		ans=(ans-dp2[i]*3%MOD+dp[i]*6%MOD+MOD)%MOD;
	cout << (ans-t*3%MOD+MOD)%MOD << "\n";
}