#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)

using namespace std;

const int N=311,mod=998244353;
int n,a[N],f[N][N*N],g[N][N*N],all,sum,res;

inline void upd(int &x,int y){x+=y; x-=x>=mod?mod:0;}

int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	all=1;
	rep (i,1,n) cin>>a[i],all=all*3ll%mod;
	f[0][0]=1;
	rep (i,1,n){
		rep (j,0,sum) if (f[i-1][j]){
			upd(f[i][j],f[i-1][j]*2ll%mod);
			upd(f[i][j+a[i]],f[i-1][j]);
		}
		sum+=a[i];
	}
	rep (i,(sum+1)>>1,sum) upd(res,f[n][i]);
	if (!(sum&1)){
		sum=0;
		g[0][0]=1;
		rep (i,1,n){
			rep (j,0,sum) if (g[i-1][j]){
				upd(g[i][j],g[i-1][j]);
				upd(g[i][j+a[i]],g[i-1][j]);
			}
			sum+=a[i];
		}
		upd(res,mod-g[n][sum/2]);
	}
	upd(all,(mod-res)*3ll%mod);
	cout<<all;
	return 0;
}