Now 99d = (100-1)d = 100d - d = 100d - 100 + 90 + 10 - d
= 100(d-1) + 10*9 + (10-d)

Thus, provided d>0 (i.e. provided abc is not a palindrome), the digits of |abc-cba| are, from left to right, (d-1), 9, and (10-d), so it's reversal is 100(10-d) + 10*9 + (d-1), and the final sum is

100((d-1)+(10-d)) + 10*(9+9) + ((10-d)+(d-1))

= 100(9) + 10*18 + 9

= 1089.

Note that this only works if we take the result of the first subtraction as a 3-digit number even if it has 2 digits. For example, if the initial number is 504, the result of the subtraction is 99, which must be read as 099.

Also, note that this doesn't work at all for palindromes. For example, 505 gives a final result of .