MOD = 998244353
def add(a, b)
  return (a.to_i + b.to_i) % MOD
end

def sub(a, b)
  return (a.to_i - b.to_i) % MOD
end

n = gets.chomp.to_i
sum = 0
a = [-1]

(1..n).each do |i|
  a[i] = gets.chomp.to_i
  sum += a[i]
end
a.sort!

a_sum = []
a_sum[n] = a[n]
(1..(n-1)).reverse_each do |i|
  a_sum[i] = a_sum[i+1] + a[i]
end

ans = (3 ** n) % MOD

dp = [{}, {}]
dp[0][0] = 1
(1..n).each do |i|
  dp[i%2] = {}
  dp[(i-1)%2].each do |k, v|
    next if 2*(k + a_sum[i]) < sum
    dp[i%2][k] = add(dp[i%2][k], 2*v)
    dp[i%2][k+a[i]] = add(dp[i%2][k+a[i]], v)
  end
end
dp[n%2].each do |k, v|
  ans = sub(ans, 3*v) if 2*k >= sum
end

if sum.even?
  dp_eq = [{}, {}]
  dp_eq[0][0] = 1
  (1..n).each do |i|
    dp_eq[i%2] = {}
    dp_eq[(i-1)%2].each do |k, v|
      next if 2*(k + a_sum[i]) < sum
      dp_eq[i%2][k] = add(dp_eq[i%2][k], v)
      dp_eq[i%2][k+a[i]] = add(dp_eq[i%2][k+a[i]], v)
    end
  end
  ans = add(ans, 3*dp_eq[n%2][sum/2].to_i)
end

puts ans