Welcome to ZOJ
Select Problem
ZOJ Problem Set - 3677
Paint Erased

Time Limit: 2 Seconds      Memory Limit: 65536 KB

There's a rope placed in two-dimensional plane, Bob will paint or erase some rectangle regions in this plane(effective on the boundary). All the regions are parallel to the axis. Your task is to calculate how long the stained rope is.


The input will consist of multiple testcases.
The first line of one testcase is two integer n, indicating the amount of rectangle regions, m, indicating the shape of rope. 1 ≤ n ≤1000, 1 ≤ m ≤100
following is n+m lines.
In the first n lines, each line has five integers type a b c d, type equals 1 to represent this is a stained region, 0 to represent a erased region. (a,b) is the lower left corner, (c,d) is the upper right corner. a ≤ c. b ≤ d, -1000000 ≤ all number ≤1000000.
In the next m lines, each line has two integers indicating the coordinate of point, connect all adjacent points to obtain the shape of rope.


Each testcase should output exactly 1 lines, each line a real number which is the answer, the output should rounded to two digits after the decimal point..

Sample Input

2 2
1 1 1 4 4
0 2 2 3 3
0 0
5 5

Sample Output



Author: CHEN, Cong
Contest: ZOJ Monthly, January 2013
Submit    Status