eolymp
bolt
Try our new interface for solving problems
Problems

Rectangles intersection

Rectangles intersection

Two rectangles are given by the integer coordinates of a pair of diagonal vertices in a rectangular coordinate system, and their sides are guaranteed to be parallel to the axes. Find the area of the common part of rectangles.

Input

Four pairs of integers (each is less than 106 by absolute value).

Output

Print the area of the common part of rectangles.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4 7 8 -3 2 4 9 1
Output example #1
12