sum from i=1 to n of (sum from j=1 to i of (j-1))