#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

#include <iostream>
using i64 = long long;
template<i64 M> struct modint { i64 a;
  constexpr modint(const i64 x = 0): a((x%M+M)%M){}
  constexpr i64 value() const { return a; }
  constexpr modint inv() const { return this->pow(M-2); }
  constexpr modint pow(i64 r) const {
    modint ans(1); modint aa = *this;
    while(r) { if(r & 1) ans *= aa; aa *= aa; r >>= 1; }
    return ans;
  }
  constexpr modint& operator=(const i64 r) { a = (r % M + M) % M; return *this; }
  constexpr modint& operator+=(const modint r) { a += r.a; if(a >= M) a -= M; return *this; }
  constexpr modint& operator-=(const modint r) { a -= r.a; if(a < 0) a += M; return *this; }
  constexpr modint& operator*=(const modint r) { a = a * r.a % M; return *this; }
  constexpr modint& operator/=(const modint r) { (*this) *= r.inv(); return *this; }
  constexpr modint operator+(const modint r) const { return modint(*this) += r; }
  constexpr modint operator-(const modint r) const { return modint(*this) -= r; }
  constexpr modint operator*(const modint r) const { return modint(*this) *= r; }
  constexpr modint operator/(const modint r) const { return modint(*this) /= r; }
  constexpr bool operator!=(const modint r) const { return this->value() != r.value(); }
};

template<const i64 M> std::ostream& operator<<(std::ostream& os, const modint<M>& m) { os << m.value(); return os; }

const i64 mod = 998244353;
using fp = modint<mod>;

int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  i64 Sigma = 0;
  rep(i,0,N) {
    cin >> A[i];
    Sigma += A[i];
  }

  fp res(0);
  {
    auto dp = ndvec(300 * 300 + 1, fp(0));
    dp[0] = fp(1);
    rep(i,0,N) {
      auto next = ndvec(300 * 300 + 1, fp(0));
      rep(j,0,next.size()) {
        next[j] += dp[j] * fp(2);
        if(j - A[i] >= 0) {
          next[j] += dp[j - A[i]];
        }
      }
      swap(dp, next);
    }
    rep(i, (Sigma + 1) / 2, dp.size()) {
      res += dp[i];
    }
  }

  fp ans = fp(3).pow(N);
  ans -= res * fp(3);

  {
    const int MAX = 300 * 300;
    auto rdp = ndvec(MAX * 2 + 2, fp(0));
    auto dp = begin(rdp) + MAX;
    dp[0] = fp(1);
    rep(i,0,N) {
      auto rnext = ndvec(MAX * 2 + 2, fp(0));
      auto next = begin(rnext) + MAX;
      for(int j = -MAX; j <= MAX; j++) {
        if(j + A[i] <= MAX) {
          next[j] += dp[j + A[i]];
        }
        if(-MAX <= j - A[i]) {
          next[j] += dp[j - A[i]];
        }
      }
      swap(rnext, rdp);
      swap(next, dp);
    }
    ans += dp[0] * 3;
  }
  cout << ans << endl;
}



Measured memory_bytes: 3204