def modpow(a,b,m)
    return b==0 ? 1 : b%2==1 ? (modpow(a,b-1,m)*a)%m : modpow(a**2,b/2,m) 
end

N=gets.to_i
A=(0...N).map{gets.to_i}
sum=A.inject(&:+)

M=998244353

sum=0
A.each do |ai|
    sum+=ai
end

sum2=(sum+1)/2


dp=Array.new(3){Array.new(90001,0)}
dp[0][0]=1
A.each do |ai|
    ddp=Array.new(3){Array.new(90001,0)}
    (0..90000).reverse_each do |i|
        if ai+i<90001
            ddp[0][i+ai]=(ddp[0][i+ai]+dp[0][i])%M
            ddp[1][i+ai]=(ddp[1][i+ai]+dp[1][i])%M
            ddp[2][i+ai]=(ddp[2][i+ai]+dp[2][i])%M
        end
        ddp[2][i]=(dp[1][i]*2+dp[2][i]*2+ddp[2][i])%M
        ddp[1][i]=(dp[0][i]+dp[1][i]+ddp[1][i])%M
    end
    dp=ddp
end

overNum=0

(sum2...90001).each do |i|
    overNum=(overNum+dp[2][i])%M
end


puts (modpow(3,A.length,M)-3*modpow(2,A.length,M)-3*overNum+3)%M