M=998244353
gets
d=1,*[0]*90000
e=1,*[0]*90000
z=1
s=0
$<.map{|a|a=a.to_i
	s.downto(0){|i|
		d[i+a]+=d[i]%M
		d[i]*=2
		e[i+a]+=e[i]%M
	}
	s+=a
	z=z*3%M
}
(s+1>>1..s).map{|i|
	z-=d[i]*3
	z%=M
}
p s%2>0?z:(z+e[s/2]*3)%M
