Most of us are probably familiar with the concept of triangular and square numbers. However, there are also pentagonal numbers, hexagonal numbers, septagonal numbers, octagonal numbers, etc. The Nth Nagonal number is defined as the Nth number of the sequence formed with a polygon of N sides. Obviously, N >= 3, as there are no 2 or 1 sided closed shapes. The first few Nth Ngonal numbers are 0, 1, 2, 6, 16, 35, 66, 112, 176, 261, 370, 506, 672, 871.... This is sequence A060354 in the OEIS.
Write a program or function that, when given an integer n as input, outputs/returns the Nth Nagonal number.
An integer N between 3 and 10^6.
The Nth Nagonal number where N is the input.
25 -> 6925 35 -> 19670 40 -> 29680
This is code-golf, lowest score in bytes wins!