URI Online Judge | 1560

# Triangle Energy

By Gabriel Dalalio, ITA Brazil

Timelimit: 5

In a plane there are N black points and M white points, without any 3 collinear points. The energy of a triangle is equal to K2, where K is the number of white points inside the triangle. What is the sum of energy of all triangles that can be formed by the black points?

## Input

The input contains several test cases. Each test case starts with a line with two integers N and M (1 ≤ N, M ≤ 100), representing the number of black and white points respectively. After the first line, there are more N + M lines with integer coordinates X, Y (0 ≤ X, Y ≤ 10000) of the black and white points. The N first coordinates represent the black points and the last M lines represent the white points.

## Output

For each test, the output consists of one line containing the energy sum of all triangles formed by black points.

 Sample Input Sample Output 3 2 0 0 10 0 0 10 2 2 8 9 4 3 0 0 10 0 0 10 10 10 1 5 9 5 5 9 1 10