#include <iostream>
using namespace std;
typedef long long ll;
ll m=998244353;
ll a[301], s[301], dp[301][90001];
ll pow(ll x, ll y){
    if(y==0)return 1;
    if(y%2==0)return pow((x*x)%m, y/2);
    return (x*pow(x, y-1))%m;
}
int main(void){
    int n;
    ll z;
    cin>>n;
    a[0]=s[0]=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        s[i]=s[i-1]+a[i];
    }
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=s[i];j++){
            dp[i][j]=dp[i-1][j]*2;
            if(j-a[i]>=0)dp[i][j]+=dp[i-1][j-a[i]];
            dp[i][j]%=m;
            //cout<<i<<", "<<j<<" : "<<dp[i][j]<<endl;
        }
    }
    z=pow(3, n);
    for(int j=(s[n]+1)/2;j<=s[n];j++){
        z+=m-dp[n][j];
        z%=m;
        z+=m-dp[n][j];
        z%=m;
        z+=m-dp[n][j];
        z%=m;
    }
    if(s[n]%2==0){
        dp[0][0]=1;
        for(int i=1;i<=n;i++){
            for(int j=0;j<=s[i];j++){
                dp[i][j]=dp[i-1][j];
                if(j-a[i]>=0)dp[i][j]+=dp[i-1][j-a[i]];
                dp[i][j]%=m;
            }
        }
        z+=dp[n][s[n]/2]*3;
        z%=m;
    }
    cout<<z<<endl;
}
