### Number of triangles

You are given a polygon of sides with vertices numbered from . Now, exactly vertices of the polygons are colored black and remaining are colored white. You are required to find the number of triangles denoted by such that:

For each test case, print the answer representing the number of triangles that can be formed with the given conditions in the problem statement.

Constraints

- The triangle is formed by joining only the white-colored vertices of the polygon.
- The triangle shares at least one side with the polygon.

- The first line contains denoting the number of test cases.
- Next lines contain three space-separated integers , , and where is the number of sides in the polygon and denote the vertices that are colored black.

For each test case, print the answer representing the number of triangles that can be formed with the given conditions in the problem statement.

Constraints

SAMPLE INPUT

1 6 2 5

SAMPLE OUTPUT

4

Explanation

The number of triangles which satisfy the property are 4 - 136 , 146 , 346 and 134

The number of triangles which satisfy the property are 4 - 136 , 146 , 346 and 134

**Note**:- I personally solving this problem scored only 85/100

## Comments

## Post a Comment

Please give us your valuable feedback