Construction#404

Construction

1 second
64 megabytes
Very easy

The city administration is selecting locations for new sports facilities. Each project under consideration requires allocating a rectangular plot of land. Some plots are partially or entirely privately owned. If a project is approved, the administration will need to purchase any occupied land, so it is essential to determine the total area of overlap with private plots to estimate the cost.

All private plots and construction sites are rectangles with sides parallel to the coordinate axes. For each project, there is a plan showing the chosen rectangle for construction and nearby private rectangles.

The figure below illustrates the intersection of private plots (thin lines) with the selected construction plot (thick line).

Input

The first line contains the number — the number of plots selected for construction.

For each plot, its plan is given as follows:

  • The first line contains — the number of private rectangles.

  • The next lines each contain the coordinates of two opposite vertices of a private rectangular plot.

  • The last line gives the coordinates of two opposite vertices of the rectangle selected for construction.

The coordinates of a rectangle are given as X_1\ Y_1\ X_2\ Y_2.

All coordinates are integers, 0 \leq X_1, Y_1, X_2, Y_2 \leq 100.

The number of private rectangles does not exceed .

Output

For each test case, output one line containing the total area of intersection of the selected construction rectangle with all private rectangles.

Examples

Example 1

Loading
Loading