#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, a[300], s;
ll DP[90334], res;

int main() {
	cin >> N;
	res = 1;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
		s += a[i];
		res *= 3;
		res %= mod998;
	}
	DP[0] = 1;
	for (int i = 0; i < N; ++i) {
		for (int j = s ; j >= 0; --j) {
			DP[j + a[i]] += DP[j];
			DP[j + a[i]] %= mod998;
			DP[j] *= 2;
			DP[j] %= mod998;
		}
	}
	for (int i = s; i * 2 >= s; --i) {
		res -= DP[i] * 3 % mod998;
		res += mod998;
		res %= mod998;
	}
	if (s % 2 == 0) {
		memset(DP, 0, sizeof DP);
		DP[0] = 1;
		for (int i = 0; i < N; ++i) {
			for (int j = s; j >= 0; --j) {
				DP[j + a[i]] += DP[j];
				DP[j + a[i]] %= mod998;
			}
		}
		res += DP[s / 2] * 3 % mod998;
		res %= mod998;
	}
	cout << res << endl;
}