Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

D. Triangles

time limit per test

2 secondsmemory limit per test

64 megabytesinput

standard inputoutput

standard outputLittle Petya likes to draw. He drew *N* red and *M* blue points on the plane in such a way that no three points lie on the same line. Now he wonders what is the number of distinct triangles with vertices in red points which do not contain any blue point inside.

Input

The first line contains two non-negative integer numbers *N* and *M* (0 ≤ *N* ≤ 500, 0 ≤ *M* ≤ 500) — the number of red and blue points respectively. The following *N* lines contain two integer numbers each — coordinates of red points. The following *M* lines contain two integer numbers each — coordinates of blue points. All coordinates do not exceed 10^{9} by absolute value.

Output

Output one integer — the number of distinct triangles with vertices in red points which do not contain any blue point inside.

Examples

Input

4 1

0 0

10 0

10 10

5 4

2 1

Output

2

Input

5 5

5 10

6 1

8 6

-6 -7

7 -1

5 -1

10 -4

-10 -8

-10 5

-2 -8

Output

7

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/17/2017 08:57:22 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|