#P12326. Calculate the Total Area of Two Rectangles

    ID: 14425 Type: Default 1000ms 256MiB

Calculate the Total Area of Two Rectangles

Calculate the Total Area of Two Rectangles

Given two rectangles (R_{1}) and (R_{2}) on a plane with sides parallel to the coordinate axes. The coordinates ((x_1, y_1)) and ((x_2, y_2)) represent the lower-left and upper-right corners of (R_{1}) respectively, and ((x_3, y_3)) and ((x_4, y_4)) represent the lower-left and upper-right corners of (R_{2}) respectively. Your task is to calculate the total area covered by the two rectangles. If the rectangles overlap, the overlapping area should only be counted once.

inputFormat

The input consists of eight space-separated integers: (x_1), (y_1), (x_2), (y_2), (x_3), (y_3), (x_4), (y_4).

outputFormat

Output a single integer representing the total area covered by the two rectangles.

sample

0 0 2 2 1 1 3 3
7