#include<bits/stdc++.h>
using namespace std;
const int md = 998244353;
int n, a[305], sm, mxlen;
long long len[90005] = {1}, x = 1, db = 3, len2[90005] = {1};
string s;

int main(){
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d", a+i);
    for(int i = 0; i < n; i++) sm += a[i];
    mxlen = (sm - 1) / 2;
    for(int i = 0; i < n; i++){
        (len[mxlen+1] *= 3) %= md;
        for(int j = mxlen; j >= 0; j--){
            if(j + a[i] > mxlen) (len[mxlen+1] += len[j]) %= md;
            else (len[j+a[i]] += len[j]) %= md;
            (len[j] *= 2) %= md;
        }
    }
    for(int i = 0; i < n; i++) for(int j = mxlen; j >= 0; j--)
            if(j + a[i] <= mxlen+1) (len2[j+a[i]] += len2[j]) %= md;
    if(sm % 2 == 0) (len[mxlen+1] += md - len2[mxlen+1]) %= md;
    (len[mxlen+1] *= 3) %= md;
    while(n){
        if(n%2) (x *= db) %= md;
        (db *= db) %= md;
        n /= 2;
    }
    printf("%lld\n", (x + md - len[mxlen+1]) % md);
}