#include <cstdio>

using i64 = long long;

// constexpr int maxn = 300;
constexpr int U = 90000;
constexpr int mod = 998244353;

inline int io() {
	static int v;
	return scanf("%d", &v), v;
}
#define io io()

inline int fpow(int v, int n) {
	int pw = 1;
	for (; n; n >>= 1, v = (i64)v * v % mod)
		if (n & 1) pw = (i64)pw * v % mod;
	return pw;
}

int main() {
	static int f[U + 1], g[U + 1];
	const int n = io;
	int sum = 0;
	f[0] = 1; g[0] = 1;
	for (int i = 1; i <= n; ++i) {
		const int a = io;
		sum += a;
		for (int j = sum; j >= a; --j)
			f[j] = (2ll * f[j] + f[j - a]) % mod,
			g[j] = (g[j] + g[j - a]) % mod;
		for (int j = a - 1; j >= 0; --j)
			f[j] = 2ll * f[j] % mod;
	}

	i64 ans = fpow(3, n);
	for (int l = (sum + 1) >> 1; l <= sum; ++l)
		ans -= 3ll * f[l] % mod;
	if (not (sum bitand 1)) ans += 3ll * g[sum >> 1];
	printf("%lld", (ans % mod + mod) % mod);

	return 0;
}
