#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=300+10;
const int MOD=998244353;
int n,a[N],dp[N][N*N],sum;

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]),sum+=a[i];
	
	dp[0][0]=1;
	for (int i=1;i<=n;i++)
		for (int j=0;j<=sum;j++) {
			dp[i][j]=dp[i-1][j];
			if (j>=a[i]) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]]*2)%MOD;
		}	
	
	int ans=0;
	for (int i=0;i<=sum/2;i++) ans=(ans+dp[n][i])%MOD;
	
	if (sum%2==0) {
		memset(dp,0,sizeof(dp)); dp[0][0]=1;
		for (int i=1;i<=n;i++)
			for (int j=0;j<=sum;j++) {
				dp[i][j]=dp[i-1][j];
				if (j>=a[i]) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%MOD;
			}
		ans=((ans-dp[n][sum/2])%MOD+MOD)%MOD;		
	}
	ans=(ans*3)%MOD;
	
	int tmp=1;
	for (int i=1;i<=n;i++) tmp=(tmp*3)%MOD;
	cout<<((tmp-ans)%MOD+MOD)%MOD<<endl;
	return 0;
}
#include <bits/stdc++.h>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 305, P = 998244353;

int n, a[N], S, f[N * N];

int main() {
	read(n);
	int ans = 1;
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
		ans = 3ll * ans % P;
		S += a[i];
	}
	f[0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = S; j >= a[i]; --j) {
			f[j] = (2ll * f[j] + f[j - a[i]]) % P;
		}
		for (int j = a[i] - 1; ~j; --j) {
			f[j] = 2ll * f[j] % P;
		}
	}
	for (int i = (S + 1) / 2; i <= S; ++i) {
		ans = (ans + 3ll * (P - f[i])) % P;
	}
	if (!(S & 1)) {
		for (int i = 0; i <= S; ++i) {
			f[i] = 0;
		}
		f[0] = 1;
		for (int i = 1; i <= n; ++i) {
			for (int j = S; j >= a[i]; --j) {
				f[j] = (f[j] + f[j - a[i]]) % P;
			}
		}
		ans = (ans + 3ll * f[S / 2]) % P;
	}
	print(ans);
}
