#!perl -ln BEGIN{($s=shift)=~s/-/../g} chomp; $x=$_; print+map{substr$x,$_-1,1}eval$s