// In the name of Allah. Ya ali!
#include<bits/stdc++.h>
#define double long double
typedef long long ll;
const ll MAX_N = 300+10;
const ll MOD = 998244353;
using namespace std;

ll dp[MAX_N][MAX_N*MAX_N];
ll pd[MAX_N][MAX_N*MAX_N];
int a[MAX_N];
ll ans,n;

int main()
{
    cin >> n;
    for(int i = 1;i<=n;++i)
        cin >> a[i];
    ans = 1;
    for(int i = 1;i<=n;++i)
        ans*=3,ans%=MOD;
    dp[0][0]++;
    pd[0][0]++;
    ll sum = 0;
    sort(a+1,a+n+1);
    for(int i = 1;i<=n;++i)
    {
        sum+=a[i];
        for(int j = 0;j<=sum;++j)
        {
            //give
            if (a[i]<=j)
            {
                dp[i][j] += dp[i-1][j-a[i]];
                dp[i][j]%=MOD;
                pd[i][j] += pd[i-1][j-a[i]];
                pd[i][j]%=MOD;
            }
            //notgive
            dp[i][j] += (dp[i-1][j]*2)%MOD;
            dp[i][j] %= MOD;
            pd[i][j] += pd[i-1][j];
            pd[i][j] %= MOD;
        }
    }
    for(int i = 0;i<=sum;++i)
    {
        if (i>=sum-i)
            ans = (ans-((dp[n][i]*3)%MOD)+MOD)%MOD;
    }
    if (sum%2==0)
        ans = (ans+((pd[n][sum/2]*3)%MOD)+MOD)%MOD;
    cout << ans;
    return 0;
}
