In the event of technical difficulties with Szkopuł, please contact us via email at email@example.com.
If you are familiar with IRC chat, the support team is also reachable on PIRC network (
#szkopul channel. If you are not, just use email.
Please do not ask us things like "how to solve task XYZ?".
Please remember that the support team has to sleep sometimes or go to work in real life.
Yesterday Little John had a test on geometry. The description of the most difficult problem follows. Given two triangles and , calculate the area of region , which is defined as follows: . For example, if has the vertices , , and has the vertices , , , then is a polygon with the vertices , , and , so its area is .
Afterwards, John started to wonder how to solve a modified problem - "How to calculate area of , if and are arbitrary convex polygons". Little John has a test on biology tomorrow and has no time to solve this problem himself. He asked you for help in solving this task.
Write a program, which:
The first line of the standard input contains two integers and () separated with a single space and denoting the numbers of vertices of polygons and . In the second line there are pairs of integers (), denoting the coordinates of consecutive vertices of the polygon (in the clockwise order). In the third line there are pairs of integers () denoting the coordinates of consecutive vertices of the polygon (in the clockwise order).
The first and only line should contain one integer - doubled area of .
For the input data:
4 4 0 0 0 1 2 1 2 0 0 0 0 2 1 2 1 0
the correct result is:
Task author: Piotr Stanczyk.