#C8771. Distinct Triangle Count

    ID: 52790 Type: Default 1000ms 256MiB

Distinct Triangle Count

Distinct Triangle Count

You are given an integer n representing the number of sticks. It is guaranteed that the sticks are such that any three of them can form a valid triangle (i.e. the sum of the lengths of any two sticks is greater than the length of the remaining one). Your task is to calculate the number of distinct triangles that can be formed by choosing any three out of the n sticks.

Note: Since every combination of three sticks is assumed to form a valid triangle, the answer is equivalent to computing the binomial coefficient \(\binom{n}{3}\) for \(n \ge 3\). For \(n < 3\) the answer is 0.

Examples:

  • For n = 3, there is exactly one triangle.
  • For n = 4, there are 4 different triangles.
  • For n = 5, there are 10 different triangles.
  • For n = 100, there are 161700 different triangles.

inputFormat

The input consists of a single integer n (where 0 ≤ n ≤ 109), which denotes the number of sticks.

The input is provided via stdin.

outputFormat

Output a single integer representing the number of distinct triangles that can be formed using the given n sticks. The result should be printed to stdout.

## sample
2
0