#include <cstdio>
using namespace std;

#define int long long

int modpow(int x, int y, int z) { int a = 1; while (y > 0) { if (y & 1) a = a * x % z; x = x * x % z; y /= 2; } return a; }
int min(const int &a, const int &b) { return a < b ? a : b; }

const int M = 998244353;
int a[300];
int d[45310];
int e[45310];

signed main() {
  int n;
  scanf("%lld", &n);
  int sum = 0;
  d[0] = 1;
  for (int i = 0; i < n; ++i) {
    scanf("%lld", a + i);
    for (int t = min(45000, sum); t >= 0; --t) {
      d[t + a[i]] += d[t] * 2 % M;
    }
    sum += a[i];
  }
  int ans = modpow(3, n, M);
  for (int t = 0; t <= sum / 2; ++t) {
    ans = (ans - d[t] * 3) % M;
  }
  if ((sum & 1) == 0) {
    int u = 0;
    e[0] = 1;
    for (int i = 0; i < n; ++i) {
      for (int t = min(sum / 2, u + 1); t >= 0; --t) {
        int *p = e + t + a[i];
        *p += e[t];
        if (*p >= M) *p -= M;
      }
      u += a[i];
    }
    ans = (ans + e[sum / 2] * 3) % M;
  }
  ans = (ans + M) % M;
  printf("%lld", ans);
}