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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 998244353;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
// powd returns x^y mod m in O(log y).
long long powd(long long x, long long y) {
  long long res=1;
  while(y){
    if(y&1) res=res*x%MOD;
    x=x*x%MOD;
    y>>=1;
  }
  return res;
}

constexpr int N_MAX=300;
constexpr int EDGE_MAX=300;
int N;
vi A;

typedef unordered_map<int, ll> element_t;
void printElement(const element_t& e) {
   cerr << "element\n";
   for (auto kv : e) {
     cerr << "  " << kv.first << ": " << kv.second << endl;
   }
}

// i以降でcを作る
vector<unordered_map<int, element_t> > cache(N_MAX);

// Aからcの作り方
// p1コ使うのがp2とおり
element_t create(int k, int c) {
  if (cache[k].count(c)>0) {
    return cache[k][c];
  }

  element_t ret;
  if (c == 0) return ret;

  for (int i=k; i<N; i++) {
    if (A[i] > c) break;
    if (A[i] == c) {
      ret[1] += 1;
      continue;
    }
    const element_t e = create(i+1, c-A[i]);
    for (auto kv : e) {
      ret[1+kv.first] += kv.second;
    }
  }

  cache[k][c] = ret;
  return ret;
}

int main(int argc, char** argv) {
  cin >> N;

  A.resize(N);
  int S = 0;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    S += A[i];
  }

  // 最長辺 < S/2.
  // その余事象を数える (三角形にならない、は全部の石をみずともわかる)

  ll ret = 0; // 余事象

  {
    // REDに固定して考える
    // dp[i][r]
    //   i番目(1-indexed)の石までみたとき、redの和r となる場合の数
    vector<vll> dp(N+1, vll(N*EDGE_MAX+1));
    dp[0][0] = 1;

    for (int i=0; i<N; i++) {
      for (int r=0; r<=N*EDGE_MAX; r++) {
        if (r >= A[i]) {
          // i-th stoneをred
          addmod(dp[i+1][r], dp[i][r-A[i]]);
        }
        // i-th stoneをgree or blue
        addmod(dp[i+1][r], dp[i][r]*2%MOD);
      }
    }

    for (int r=(S+1)/2; r<=N*EDGE_MAX; r++) {
      addmod(ret, dp[N][r]);
    }
  }

  // cerr << "yo red " << ret << endl;

  if (S%2==0) {
    // (S/2, S/2, 0)を数えすぎているので、引く
    vector<vll> dp(N+1, vll(N*EDGE_MAX+1));
    dp[0][0]=1;

    for (int i=0; i<N; i++) {
      for (int r=0; r<=N*EDGE_MAX; r++) {
        if (r >= A[i]) {
          // i-th stoneをred
          addmod(dp[i+1][r], dp[i][r-A[i]]);
        }
        // i-th stoneをgreen
        addmod(dp[i+1][r], dp[i][r]%MOD);
      }
    }

    ll tmp = dp[N][S/2];
    addmod(ret, -tmp+MOD);
  }

  // cerr << "yo red " << ret << endl;
  ret = ret*3%MOD;

  ll ans = powd(3, N);
  ans = (ans-ret+MOD)%MOD;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 212864