#include <bits/stdc++.h> 

using namespace std;
using ll = long long;

int main() {
	const ll MOD = 998244353;
	int N;
	cin >> N;
	vector<ll> a(N);
	int sum = 0;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		sum += a[i];
	}

	vector<vector<ll>> dp(N + 1, vector<ll>(sum + 1, 0));
	dp[0][0] = 1;
	auto dp2 = dp;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j + a[i] <= sum; ++j) {
			(dp[i + 1][j + a[i]] += dp[i][j]) %= MOD;
			(dp[i + 1][j] += dp[i][j] * 2) %= MOD;

			(dp2[i + 1][j + a[i]] += dp2[i][j]) %= MOD;
			(dp2[i + 1][j] += dp2[i][j]) %= MOD;
		}
	}
				
	ll res = 1; 
	for (int i = 1; i <= N; ++i) { (res *= 3) %= MOD; }

	ll rm = 0;
	for (int i = sum / 2 + 1; i <= sum; ++i) {
		(rm += (dp[N][i] * 3)) %= MOD;
	}
	if (sum % 2 == 0) {
		(rm += (dp[N][sum / 2] - dp2[N][sum / 2] * 2) * 3) %= MOD;
		(rm += (dp2[N][sum / 2] * 3)) %= MOD;
	}

	res = (res - rm + MOD) % MOD;
	cout << res << endl;

	return 0;
}
