Green plantings
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Knowing the coordinates of the opposite corners of several planned forest planting areas, each shaped as a rectangle with sides parallel to the coordinate axes, calculate the total perimeter of these green plantings.
Input
The first line contains the number of planted areas, N (1 ≤ N ≤ 100). Each of the following N lines contains 4 integers, separated by spaces, representing the coordinates of the opposite corners of each rectangular area.
X_1, Y_1, X_2, Y_2 ≤ |2000|
Output
Output a single number: the total perimeter of the green plantings.
Examples
Input #1
Answer #1
Submissions 199
Acceptance rate 21%