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