const val P = 998244353L

fun mod(x: Long) = if (x >= 0) x % P else (P - ((-x) % P)) % P
fun modPlus(x1: Long, x2: Long) = (x1 + x2) % P
fun modMinus(x1: Long, x2: Long) = (x1 + P - x2) % P

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = IntArray(n, { readLine()!!.toInt() })
  val s = xs.sum()

  val count3 = LongArray(s + 1)
  count3[0] = 1
  for (i in 0 until n) {
    for (k in s downTo 0) {
      if (count3[k] == 0L) continue
      count3[k + xs[i]] = modPlus(count3[k + xs[i]], count3[k])
      count3[k] = modPlus(count3[k], count3[k])
    }
  }

  val count2 = LongArray(s + 1)
  count2[0] = 1
  for (i in 0 until n) {
    for (k in s downTo 0) {
      if (count2[k] == 0L) continue
      count2[k + xs[i]] = modPlus(count2[k + xs[i]], count2[k])
      count2[k] = count2[k]
    }
  }

  var remove = 0L
  remove = modPlus(remove, 3L * pow2(n) % P)
  for (k in 0..s) {
    if (k >= (s + 1) / 2) {
      remove = modPlus(remove, 3L * count3[k] % P)
    }
  }
  for (k in 0..s) {
    if (k >= (s + 1) / 2) {
      remove = modMinus(remove, 6L * count2[k] % P)
    }
  }

  val total = pow3(n)
  val ans = modMinus(total, remove)
  println(ans)
}

fun pow2(n : Int): Long {
  if (n == 0) return 1L
  val x = pow2(n - 1)
  return 2 * x % P
}

fun pow3(n: Int): Long {
  if (n == 0) return 1L
  val x = pow3(n - 1)
  return 3 * x % P
}