Sandwiches#1149

Sandwiches

1 secondo
128 megabyte
Molto facile

Pavlo loves making sandwiches. His signature sandwich, the "Coupe," is made from four main ingredients: a top slice of bread, a slice of cheese, a slice of ham, and a bottom slice of bread. All the ingredients are rectangular in shape. One day, he decided to make this sandwich quickly. To do so, he threw the ingredients into the air, hoping they would fall and stack in the correct order. However, the ingredients landed on the table in a random arrangement.

Pavlo is also a fan of the game "Tic-tac-toe," so the tablecloth on his desk resembles a checkered plane. Quickly applying a coordinate grid to his desk, Pavlo determined which cell each ingredient fell into. It turned out that each ingredient was a rectangle with corners at integer coordinates and sides parallel to the coordinate axes.

prb1149-1

Now, Pavlo wants to know the total area of the table covered by his sandwich. Your task is to write a program that calculates this area.

Input

There are four lines, each containing four integers: the coordinates of the lower left and upper right corner of the next ingredient.

The coordinate grid is set such that the first coordinate increases from left to right, and the second increases from bottom to top.

All numbers do not exceed in absolute value.

Output

Print a single integer — the answer to the problem.

Esempi

Esempio 1

Loading
Loading

Esempio 2

Loading
Loading