Double sum of products of integers up to $n$ Suppose that $S$ is defined by
$$
S(n) = \sum_{i=0}^{n} \sum_{j=0}^{i} ij.
$$
I'm confused as to how $S(3) = 25$ from this summation.  Can anyone expand on it as to how to get the answer? 

\begin{align*}
  S(3) &= \sum_{i=0}^3\sum_{j=0}^i ij \\
       &= 0\sum_{j=0}^0 j + 1\sum_{j=0}^1 j + 2\sum_{j=0}^2 j + 3\sum_{j=0}^3 j \\
       &= 0 + (0+1) + 2(0+1+2) + 3(0+1+2+3) \\
       &= 25.
\end{align*}
More generally,
\begin{align*}
  S(n) &= \sum_{i=0}^n\sum_{j=0}^i ij \\
       &= \sum_{i=0}^n i\cdot\frac{i(i+1)}{2} \\
       &= \frac{1}{2}\sum_{i=0}^n i^3+i^2 \\
       &= \frac{1}{2}\left(\frac{n^2(n+1)^2}{4} + \frac{n(n+1)(2n+1)}{6}\right) \\
       &= \frac{1}{24}(3 n^4+10 n^3+9 n^2+2 n).
\end{align*}
