m=998244353 b=1 q=1 r='m+1>>1' read a read a for a in $a;{(( b+=q, b-=b>1)%m, a || (b=c=d=e=0), a<0 && (t=b,b=c,c=t,t=d,d=e,e=t), (a&3)==2 && (d=b,e=c,b=c=0), z=(z+e*r)%m ));} echo $[(z+e*r)%m]