#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll MOD = 998244353;
ll x[301];
int N;

ll dp1[301][100001]; // 3-color
ll dp2[301][100001]; // 2-color


int main() {
    cin >> N;
    ll S = 0;
    ll ans = 1;
    for(int i = 0; i < N; i++) {
        cin >> x[i];
        S += x[i];
        ans *= 3;
        ans %= MOD;
    }

    dp1[0][0] = dp2[0][0] = 1;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 100001; j++) {
            dp1[i+1][j+x[i]] += dp1[i][j]; // 色を塗り替えても同じ．
            dp1[i+1][j+x[i]] %= MOD;
            dp1[i+1][j] += (2*dp1[i][j])%MOD;
            dp1[i+1][j] %= MOD;

            dp2[i+1][j+x[i]] += dp2[i][j];
            dp2[i+1][j+x[i]] %= MOD;

            dp2[i+1][j] += dp2[i][j];
            dp2[i+1][j] %= MOD;
        }
    }

    for(int i = (S+1)/2; i <= S; i++) {
        ans -= (dp1[N][i] * 3) % MOD; // 条件(S/2 > i)を満たさない数を引く
        ans %= MOD;
    }

    if(S%2 == 0) {
        ans += (dp2[N][S/2]*3 % MOD);
    }

    ans += MOD;
    ans %= MOD;
    cout << ans << endl;

}
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll ppow(ll a,ll b){
	a%=MOD;
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
class Fact{
	vector<ll>fact;
	vector<ll>inv;
public:
	Fact(){}
	Fact(int n){
		n=n*2+10;
		fact=inv=vector<ll>(n);
		fact[0]=inv[0]=1;
		for(int i=1;i<n;i++){
			fact[i]=(fact[i-1]*i)%MOD;
		}
		inv[n-1]=ppow(fact[n-1],MOD-2);
		for(int i=n-2;i>=0;i--){
			inv[i]=(inv[i+1]*(i+1))%MOD;
		}
	}
	ll get(int n){
		return fact[n];
	}
	ll get_inv(int n){
		return inv[n];
	}
	ll nPr(int n,int r){
		return fact[n]*inv[n-r]%MOD;
	}
	ll nCr(int n,int r){
		return nPr(n,r)*inv[r]%MOD;
	}
	ll nrP(int n,int r){
		return nPr(n+r,n);
	}
	ll nrC(int n,int r){
		return nCr(n+r,n);
	}
};

int main(){
	int n,m;cin>>n>>m;
	Fact fac(3*m+n);
	ll ans=0;
	for(int s=m%2;s<=min(n,m);s+=2){
		ll a=fac.nCr(n,s);
		ll b=fac.nCr((3*m-s)/2+n-1,n-1);
		if((3*m-s)/2>=m)(b+=MOD-fac.nCr((3*m-s)/2-m+n-1,n-1)*s%MOD)%=MOD;
		if((3*m-s)/2>=m+1)(b+=MOD-fac.nCr((3*m-s)/2-m-1+n-1,n-1)*(n-s)%MOD)%=MOD;
		(ans+=a*b)%=MOD;
	}
	cout<<ans<<endl;
}