import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val num = Array.tabulate(n){_ ⇒ readInt}.sorted(Ordering.Int.reverse)
  println(solve(num))
  def solve(num: Array[Int]): Long = {
    val mod: Long = 998244353L
    val sum = num.sum
    val overHalfMemo = Array.tabulate(num.length){_ ⇒ Array.tabulate((sum + 1) / 2){_ ⇒ -1L}}
    val justHalfMemo = Array.tabulate(num.length){_ ⇒ Array.tabulate((sum + 1) / 2){_ ⇒ -1L}}
    val power3: Array[Long] = Array.tabulate(num.length + 1){_ ⇒ 1L}
    for (i ← 1 until power3.length) power3(i) = (power3(i - 1) * 3) % mod
    def overHalf(position: Int, currentSum: Int): Long = {
      if (currentSum * 2 >= sum) return power3(num.length - position)
      if (position >= num.length) return 0
      if (overHalfMemo(position)(currentSum) < 0) overHalfMemo(position)(currentSum) = (overHalf(position + 1, currentSum + num(position)) + 2 * overHalf(position + 1, currentSum)) % mod
      overHalfMemo(position)(currentSum)
    }
    def justHalf(position: Int, currentSum: Int): Long = {
      if (currentSum * 2 > sum) return 0
      if (currentSum * 2 == sum) return 1
      if (position >= num.length) return 0
      if (justHalfMemo(position)(currentSum) < 0) justHalfMemo(position)(currentSum) = (justHalf(position + 1, currentSum + num(position)) + justHalf(position + 1, currentSum)) % mod
      justHalfMemo(position)(currentSum)
    }

    val over = overHalf(0, 0)
    val just = justHalf(0, 0)
    ((power3.last - (over - just)) % mod + mod) % mod
  }
}
