<>;@a=(0)x(<>+1);$_=<>;y/*//d;s/(x*)(\d)/$2$1/g;s/\bx/1x/g;/d/?++$D:/}/?--$D:${$n=y///c;$d=$D;$d--?$_*=$n:($a[$n]+=$_)until--$n<0}for/d|\dx*|}/g;print"@a"