Consider all three-digit numbers that are greater than the sum of the squares of their digits by exactly 543. What are the last three digits of the sum of these numbers?

To find the last three digits of the sum of these numbers, we will first determine the three-digit numbers that satisfy the given condition, and then sum them up.

Let's analyze the given condition: a three-digit number is greater than the sum of the squares of its digits by exactly 543. So, let's write an equation based on this condition.

Let the three-digit number be represented as ABC, where A, B, and C are the digits. We can now form the equation:

ABC = A^2 + B^2 + C^2 + 543

To find all the possible values of ABC, we can loop through all the possible values of A, B, and C, each ranging from 0 to 9.

Next, we'll calculate A^2 + B^2 + C^2, and check if it satisfies the given condition by adding 543. If it does, we'll add the corresponding value of ABC to our running sum.

Here's the Python code that performs this calculation:

```python
total_sum = 0

for A in range(10):
for B in range(10):
for C in range(10):
ABC = A * 100 + B * 10 + C
sum_squares = 2 + B**2 + C**2
if ABC == sum_squares + 543:
total_sum += ABC

print(total_sum)
```

Running this code will give us the sum of all three-digit numbers satisfying the given condition.

Finally, we can take the last three digits of the sum to answer the question.