#include <bits/stdc++.h>

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()

int get_int(){int x;scanf("%d",&x);return x;}

typedef long long ll;

const int mod = 998244353;
inline int mul(int x,int y){return 1ll*x*y%mod;}
int add(int x,int y) {return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y) {return x-y>=0?x-y:x-y+mod;}
int sq(int x){return 1ll*x*x%mod;}
int pows(int a,int b){return b == 0?1:(b&1?mul(a,sq(pows(a,b/2))):sq(pows(a,b/2)));}


const int maxn = 305;
int cnt[maxn*maxn];
int cnt2[maxn*maxn];

int sum;
int N;





void cal(int n,vector<int> &vi){
    cnt[0] = 1;
    cnt2[0] = 1;
    _for(i,0,N){
        int l = vi[i];
        for(int j = sum;j>=0;j--){
            cnt2[j] = add(cnt2[j],cnt2[j]);
            if(j-l >= 0) {
                cnt[j] = add(cnt[j],cnt[j-l]);
                cnt2[j] = add(cnt2[j],cnt2[j-l]);
            }
        }
    }
}

int main()
{
    vector<int> vi;
    N = get_int();
    _for(i,0,N){
        int num = get_int();
        sum += num;
        vi.push_back(num);
    }
    sort(ALL(vi));

    int ans = pows(3,N);
    //printf("all:%d\n",ans);

    cal(N,vi);
    //_rep(i,0,sum) printf("%d\n",cnt2[i]);

    _rep(i,(sum+1)/2,sum){
        ans = sub(ans,mul(3,cnt2[i]));
        //printf("%d\n",cnt2[i]);
    }

    if(!(sum&1)){
        ans = add(ans,mul(cnt[sum/2],3));
    }

     printf("%d\n",ans);
    return 0;
}

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
//#define mod 998244353
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int dp1[310][90909] = { 0 };
int dp2[310][90909] = { 0 };

signed main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N, sum = 0;
	int mod = 998244353;
	cin >> N;
	VI A(N);
	REP(i, N) {
		cin >> A[i];
		sum += A[i];
	}

	dp1[0][0] = 1;
	REP(i, N) {
		REP(j, 90909) {
			if (j + A[i] < 90909) {
				dp1[i + 1][j + A[i]] += dp1[i][j];
				dp1[i + 1][j + A[i]] %= mod;
			}
			dp1[i + 1][j] += 2 * dp1[i][j];
			dp1[i + 1][j] %= mod;
		}
	}

	int x = 0;
	REP(j, 90909) {
		if (j * 2 >= sum) {
			x += dp1[N][j];
			x %= mod;
		}
	}

	dp2[0][0] = 1;
	REP(i, N) {
		REP(j, 90909) {
			if (j + A[i] < 90909) {
				dp2[i + 1][j + A[i]] += dp2[i][j];
				dp2[i + 1][j + A[i]] %= mod;
			}
			dp2[i + 1][j] += dp2[i][j];
			dp2[i + 1][j] %=mod;
		}
	}

	int y = (sum % 2 == 0) ? dp2[N][sum / 2] : 0;

	int ans = 1;
	REP(i, N) {
		ans *= 3;
		ans %= mod;
	}
	//cout << x << endl;
	//cout << y << endl;
	//cout << ans << endl;
	//cout << (ans-3*x+3*y)%mod << endl;
	ans = (ans - 3 * x + 8 * mod) % mod;
	ans += 3 * y;

	cout << ans % mod << endl;

	return 0;
}

