sum of all substrings of a number