perl -ape '@A=map[map-105+ord,/./g],"!c","1t","9c","eoej";$_="@{[map{/.*/;$a=$b=0;$a+=$_*(@F>4?$A[$&-1][$b++]:24*$&**++$b)for@F;$a/24}1..9]}";s/( 0)*$/ /'