# Sum of 5 squares

**Discrete Mathematics**Level 5

Brilli the ant is considering the complexities of a 5-dimensional universe. She wants to count the number of integer points that are distance \( \sqrt{n} \) away from the origin. Let \(T_n\) be the set of ordered 5-tuples of integers \((a_1,a_2,a_3,a_4,a_5)\) such that \(a_1^2 + a_2^2 + a_3^2 + a_4^2 + a_5^2 = n.\) However, being an ant, she doesn't have enough toes to record numbers that are above 10. Let \(D_n\) be the units digit of \(\vert T_n \vert.\)

Determine \(\sum_{i = 1}^{5678} D_i.\)

**Details and assumptions**

Note: You are not asked to find the last digit of the sum, but the sum of all the last digits.

For a set \(S\), \( | S | \) denotes the number of elements in \(S\). You can read up on set notation.