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