 Legs $L_{1}, L_{2}, L_{3}, L_{4}$ of a square table each have length $n$, where $n$ is a positive integer. For how many ordered 4 -tuples ( $k_{1}, k_{2}, k_{3}, k_{4}$ ) of nonnegative integers can we cut a piece of length $k_{i}$ from the end of leg $L_{i}$ and still have a stable table? (The table is stable if it can be placed so that all four of the leg ends touch the floor. Note that a cut leg of length 0 is permitted.)
Flip the table upside-down so that that the table's surface rests on the floor. Then, we see that we want the truncated legs to have endpoints \(A, B, C, D\) which are coplanar (say).  Claim - This occurs if and only if \(A B C D\) is a parallelogram.   In still other words, we are counting the number of solutions to  $$ \left(n-k_{1}\right)+\left(n-k_{3}\right)=\left(n-k_{2}\right)+\left(n-k_{4}\right) \Longleftrightarrow k_{1}+k_{3}=k_{2}+k_{4} . $$  Define  $$ a_{r}=\#\{(a, b) \mid a+b=r, 0 \leq a, b \leq n\} $$   $$ \begin{aligned} \sum_{r=0}^{2 n} a_{r}^{2} & =1^{2}+2^{2}+\cdots+n^{2}+(n+1)^{2}+n^{2}+\cdots+1^{2} \\ & =\frac{1}{3}(n+1)\left(2 n^{2}+4 n+3\right) \end{aligned} $$