By the way, the sum of the arithmetic series is n^2.

The sum of the geometric series is n^2*(n^(2n) - 1)/(n^2 - 1)

Thus the total is n^2*(1 + (n^(2n) - 1)/(n^2 - 1))