This page is still under construction.

Parts of this page are still being built. What you see may change.

Points

Time limit1sMemory limit128 MB

Summary
Count triangles formed by white points that have no black point strictly inside them.
Level

Medium7 of 10

Topics
Geometry, Combinatorics, Sorting, Two pointers
Solved
No attempts yet

Problem

There are n+mn + m points on the plane. Exactly nn of them are white and the remaining mm are black.

Count the number of triangles whose three vertices are white points and that contain no black point in their interior.

You may assume that no three points are collinear.

Input

The first line contains two integers nn and mm (0≤n,m≤5000 \le n, m \le 500), the number of white points and the number of black points, respectively.

The next nn lines describe the white points, and the following mm lines describe the black points. Each line contains two integers xx and yy (−109≤x,y≤109-10^9 \le x, y \le 10^9), the coordinates of a point.

Output

Print, on a single line, the number of triangles with white vertices that contain no black point inside.

Hint

The figure above illustrates the first example.

Examples3

  1. Example 1

    Input
    4 1
    6 0
    3 6
    3 3
    0 0
    2 1
    
    Expected output
    2
    
  2. Example 2

    Input
    3 1
    0 0
    10 0
    0 10
    1 1
    
    Expected output
    0
    
  3. Example 3

    Input
    3 1
    0 0
    10 0
    0 10
    100 100
    
    Expected output
    1