If the nth term of the sequence is given by (n2−1)(n+1) , then the sum of first n terms of the sequence is given by