#include <iostream>

using namespace std;

const int MOD = 998244353;

typedef long long ll;

ll dp[90001];
ll dp_[90001];
ll dp1[90001];
ll dp1_[90001];

void copy(){
    for(int i = 0; i <= 90001; i++){
        dp_[i] = dp[i];
        dp1_[i] = dp1[i];
    }
}

int main(){
    int N;
    int a[300];
    ll ans;
    cin >> N;
    ll sum = 0;
    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;
        ans %= MOD;
    }
    dp[0] = 1;
    dp1[0] = 1;
    for(int i = 0; i < N; i++){
        copy();
        for(int j = 0; j <= 90000; j++){
            dp[j] *= 2;
            dp[j]%= MOD;
        }
        for(int j = 0; j+a[i] <= 90000; j++){
            dp[j+a[i]] += dp_[j];
            dp[j+a[i]]%= MOD;
            dp1[j+a[i]] += dp1_[j];
            dp1[j+a[i]]%= MOD;
        }
    }
    for(int i = (sum+1)/2; i <= 90000; i++){
        ans -= dp[i]*3;
        ans %= MOD;
        ans += MOD;
        ans %= MOD;
    }
    if(sum%2 == 0){
        ans += 3*dp1[sum/2];
    }
    ans %= MOD;
    //cout << dp1[sum/2] << endl;
    cout << ans << endl;
}