$l=length($S=<>)-1;$S=~s/.*/$&$&/; $_=substr($S,$_,$l),/^\D|\D$/||(s/0+\B//g,print("$_ $-$/"),$%+=$-=(eval)-$%)for 0..$l-1; print$%