#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n,S=0;
ll ans=0;
vector<int> a;
ll dp[400][100000],dp2[400][50000];

struct mod_fac{
    private:
        vector<ll> f,i_f;
        int n;ll MOD;
    public:
        void init(int n,ll m){
            MOD=m;
            f.resize(n+1,0);
            i_f.resize(n+1,0);
            f[0]=1;
            rep(i,n){
                f[i+1]=f[i]*(i+1)%MOD;
            }
            i_f[n]=power(f[n],MOD-2);
            per(i,n){
                i_f[i]=(i_f[i+1]*(i+1))%MOD;
            }
        }
        ll power(ll a ,ll x){
            if (x==0) return 1;
            if (x==1) return a%MOD;
            if (x==2) return (a*a)%MOD;
            if (x%2==1) return (a*power(power(a,(x-1)/2),2))%MOD;
            return (power(power(a,x/2),2))%MOD;
        }
        ll fac(int x){
            return f[x];
        }
        ll invfac(int x){
            return i_f[x];
        }
        ll comb(int m,int k){
            if (m<0 or k<0) return 0;
            if (m<k) return 0;
            return (((f[m]*i_f[k])%MOD)*i_f[m-k])%MOD;
        }
};

void solve(){
    cin >> n;
    mod_fac mo;mo.init(1,mod);
    rep(i,n){
        int a_;
        cin >> a_;
        a.push_back(a_);
        S+=a_;
    }
    rep(i,n+1){
        rep(k,(S+1)/2+1){
            dp[i][k]=0;
        }
    }
    dp[0][0]=1;
    rep(i,n){
        rep(k,S+1){
            //cout << i << " " << k << " " << dp[i][k] << endl;
            dp[i+1][k]+=2*dp[i][k];
            dp[i+1][k]%=mod;
            if (k+a[i]<=S) {
                dp[i+1][k+a[i]]+=dp[i][k];
                dp[i+1][k+a[i]]%=mod;
            }
        }
    }
    Rep(i,(S+1)/2,S+1){
        ans+=dp[n][i];
        ans%=mod;
    }
    //cout << ans << endl;
    if (S%2==1) cout << (mo.power(3,n)-3*ans+3*mod)%mod << endl;
    else {
        rep(i,n+1){
            rep(k,(S+1)/2+1){
                dp2[i][k]=0;
            }
        }
        dp2[0][0]=1;
        rep(i,n){
            rep(k,S/2+1){
                //cout << i << " " << k << " " << dp[i][k] << endl;
                dp2[i+1][k]+=dp2[i][k];
                dp2[i+1][k]%=mod;
                if (2*(k+a[i])<=S) {
                    dp2[i+1][k+a[i]]+=dp2[i][k];
                    dp2[i+1][k+a[i]]%=mod;
                }
            }
        }
        //cout << dp2[n][S/2] << endl;
        cout << (mo.power(3,n)-3*ans+3*dp2[n][S/2]+3*mod)%mod << endl;
    }

    
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 356480