999 - (whatever number under 500), subtract each of the three digits from 9.

Now add one to the result, making (1000 - the number)

Now (that second result - 500) is (500 - the number).

Or simply 499 - the number (there isn't any carry) and then add 1 to the result