#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

ll dp[310][90010];
int N, A[310];
ll mod = 998244353;
ll ans = 0;
int sum;

int main()
{
    cin >> N;
    for(int i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
    }

    ans = 1;
    for(int i = 0; i < N; i++)ans = ans * 3 % mod;

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j <= 90000; j++)
        {
            dp[i + 1][j] += 2 * dp[i][j];
            dp[i + 1][j] %= mod;
            dp[i + 1][j + A[i]] += dp[i][j];
            dp[i + 1][j + A[i]] %= mod;
        }
    }

    for(int i = (sum + 1) / 2; i <= 90000; i++)
    {
        ans += 3 * (mod - dp[N][i]);
        ans %= mod;
    }

    if(sum % 2 == 0)
    {
        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;
        for(int i = 0; i < N; i++)
        {
            for(int j = 0; j <= 90000; j++)
            {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= mod;
                dp[i + 1][j + A[i]] += dp[i][j];
                dp[i + 1][j + A[i]] %= mod;
            }
        }

        ans += 3 * dp[N][sum / 2];
        ans %= mod;
    }


    cout << ans << endl;
    return 0;
}
