eolymp
bolt
Try our new interface for solving problems
Problems

Triangles in the polygon

Triangles in the polygon

\includegraphics{https://static.e-olymp.com/content/7f/7f50822de3d5a9fadeb9ef4abbcc943e09b1f3c9.jpg} \textbf{Rain in an oak forest. 1891.}\textit{ Motives for genre painting, introduced into the landscape, it is extremely rare for Shishkina, though this technique has greatly contributed to the success of paintings from the general public. But the true value of this work is perfectly expressed by the state of nature: starting small, drizzling rain, wet, slippery trails, the gray-watery air.} In the convex \textbf{n} - gon take all the diagonals, no three of which pass through one point. How many different triangles formed? \includegraphics{https://static.e-olymp.com/content/25/2567b487fe9ff87e4467ac563e9e2873659e4916.jpg} \InputFile Each line is a separate test and contains a positive integer \textbf{n} (\textbf{2} < \textbf{n} ≤ \textbf{1000}). \OutputFile For each test on a separate line to derive the number of different triangles which are obtained after all the diagonals.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
4
5
Output example #1
1
8
35
Source Медведев М.Г. - Зимняя школа в Харькове 2009