{
up=0
echo -n 0
for i in 0 $(cat - | sed 's|\(.\)|\1 |g'); do echo ${i} ; done | tac | while read -r j; do
        echo == ${j} >> e.log
        _j=$((${j} + ${up}))
        if [ ${_j} -ge 4 ]; then
                #echo store return $((10 - ${_j}))  >> e.log
                echo -n " + $((10 - ${_j}))"
                up=1
        elif [ ${_j} -eq 0 ]; then
                :
        else
                #echo customer pay ${_j}  >> e.log
                echo -n " + ${_j}"
                up=0
        fi
done
echo
} | bc