// インクルード(GCC only)
#include <bits/stdc++.h>

// 長い型名
using namespace std;
typedef long long LL;

// 省略記法
#define INF 1e9
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i##_len=(n), i=(i##_len-1); i>=0; ++i)
#define FOR(i,m,n) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define all(x) (x).cbegin(),(x).cend()
#define sizei(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define printvector(x) rep(i,sizei(x)){cout << x[i] << endl;}
#define summation(x) (accumulate(all(x), 0LL))
#define product(x) (accumulate(all(x), 1LL, [](int acc, int i) { return acc * i;}))


// mod付き四則演算(mod関数のオーバーヘッドが重いかも)
// TODO: 二項係数、離散対数、平方剰余の実装
//#define MOD 1000000007LL
#define MOD 998244353LL
inline LL mod(LL const &a) { return (a % MOD + MOD) % MOD; }
inline LL madd(LL const &a, LL const &b) { return mod(mod(a) + mod(b)); }
inline LL msub(LL const &a, LL const &b) { return mod(mod(a) - mod(b)); }
inline LL mmul(LL const &a, LL const &b) { return mod(mod(a) * mod(b)); }
inline LL mpow(LL a, LL b) {
  LL r = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) (r *= a) %= MOD;
    (a *= a) %= MOD;
  }
  return r;
}
inline LL minv(LL const &a) { return mpow(a, MOD-2); }
inline LL mdiv(LL const &a, LL const &b) { return mod(mod(a) * minv(b)); }


// デバッグ用
#ifdef LOCAL
    #define TO_STRING(VariableName) # VariableName
    #define eprint(...) {fprintf(stderr, "DEBUG: "); fprintf(stderr, __VA_ARGS__);}
    #define eprintvector(x) rep(i,sizei(x)){cerr << "DEBUG: " << TO_STRING(x) << "[" << i << "]" << " = " << x[i] << endl;}
#else
    #define eprint(...) 42
    #define eprintvector(x) 42
#endif

/**************** 便利な関数 ****************/
vector<string> split_impl(string &&s, regex &&r) { return { sregex_token_iterator{s.begin(), s.end(), r, -1}, sregex_token_iterator{} }; }
auto split(string s, string pattern) { return split_impl(move(s), regex{pattern}); }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


/**************** ラムダ再帰用 ****************/
template<typename F>
class FixPoint : F
{
public:
  explicit constexpr FixPoint(F&& f) noexcept
    : F(std::forward<F>(f))
  {}
 
  template<typename... Args>
  constexpr decltype(auto)
  operator()(Args&&... args) const
  {
    return F::operator()(*this, std::forward<Args>(args)...);
  }
};
 
template<typename F>
static inline constexpr decltype(auto)
makeFixPoint(F&& f) noexcept
{
  return FixPoint<F>{std::forward<F>(f)};
}

int main(void)
{
    LL N, p3 = 1, result = 0;
    cin >> N;
    
    vector<LL> a(N + 1);
    FOR(i, 1, N + 1) {
        cin >> a[i];
        p3 = mmul(p3, 3LL);
    }

    LL sum = summation(a);
    vector<vector<LL>> dp(N + 1, vector<LL>(300*300 + 1, 0));
    vector<vector<LL>> dp2(N + 1, vector<LL>(300*300 + 1, 0));

    dp[0][0] = 1;

    FOR(i, 1, N + 1) {
        rep(j, sum + 1) {
            if (j >= a[i]) {
                dp[i][j] = madd(mmul(dp[i - 1][j], 2LL), dp[i - 1][j - a[i]]);
            }
            else {
                dp[i][j] = mmul(dp[i - 1][j], 2LL);
            }
        }
    }

    FOR(i, (sum + 1) / 2, sum + 1) {
        result = madd(result, dp[N][i]);
    }

    if (sum % 2 == 0) {
        dp2[0][0] = 1;
        FOR(i, 1, N + 1) {
            rep(j, 300*300 + 1) {
                if (j >= a[i]) {
                    dp2[i][j] = madd(dp2[i - 1][j], dp2[i - 1][j - a[i]]);
                }
                else {
                    dp2[i][j] = dp2[i - 1][j];
                }
            }
        }

        result = msub(result, dp2[N][sum/2]);
    }

    eprint("%lld, %lld\n", p3, result);

    result = msub(p3, mmul(result, 3LL));

    cout << result << endl;

    return 0;
}


Measured memory_bytes: 424512