#include<iostream>
using namespace std;
typedef long long ll;
#define int ll
const ll mod=998244353;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll dp[305][90005]={0};
ll dp2[305][90005]={0};
signed main(){
  ll n,sum=0;
  cin>>n;
  dp[0][0]=1;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    if(i==0) dp2[1][a]=1;
    sum+=a;
    for(int j=0;j<90005;j++){
      dp[i+1][j]+=dp[i][j]*2;
      dp[i+1][j+a]+=dp[i][j];
      dp[i+1][j]%=mod;
      dp[i+1][j+a]%=mod;

      dp2[i+1][j]+=dp2[i][j];
      dp2[i+1][j+a]+=dp2[i][j];
      dp2[i+1][j]%=mod;
      dp2[i+1][j+a]%=mod;
    }
  }
  ll ans=pow(3,n);
  for(int i=(sum+1)/2;i<=sum;i++){
    ans+=mod;
    ans-=(dp[n][i]*3)%mod;
    ans%=mod;
  }
  if(sum%2==0) {
    ans+=mod;
    ans+=(dp2[n][sum/2]*6)%mod;
    ans%=mod;
  }
  cout<<ans<<endl;
}
