Minimum triangulation#11259

Minimum triangulation

1 second
128 megabytes
Medium

You are given a regular polygon with vertices numbered from to in counterclockwise order.

Triangulation of this polygon is a decomposition into triangles such that:

The weight of a triangulation is defined as the sum of the weights of its triangles, where the weight of a triangle is the product of the labels of its vertices.

Find the minimum weight among all possible triangulations of the given polygon.

Input

One integer n~(3 \le n \le 500) — the number of vertices of the polygon.

Output

Print the minimum weight among all triangulations of the given polygon.

Examples

In the first test case, the polygon is a triangle with vertices . Its weight is 1 \cdot 2 \cdot 3 = 6.

In the second test case, the polygon is a square with vertices 1, 2, 3, 4. The minimum weight is achieved by the triangulation with the diagonal :

1 \cdot 2 \cdot 3 + 1 \cdot 3 \cdot 4 = 6 + 12 = 18

Example 1

Loading
Loading

Example 2

Loading
Loading