# Cut the rectangle

Given a large rectangle I decided to take two pieces.

For the first piece make a rectangular cut (each side of this cut is parallel to the corresponding side of the cake) inside the cake. Now the cake have two pieces. I take the piece inside the rectangle cut. For the second piece, make another rectangular cut (each side of this cut is parallel to the corresponding side of the cake) inside the cake. Now the cake again have two pieces. I take the piece inside the rectangle cut (note that this piece may not be rectangular, because of cut may cross an empty space that remains from the first piece, also it can be empty).

Given the cuts determine the amount of cake that I will have. The amount is calculated as the sum of the areas covered by your pieces.

Example : A rectangle is defined by four integers (co-ordinate of the lower-left corner (x1,y1) and upper right corner (x2,y2)).Let here they are : -

Piece 1 : (1,1) and (20,20)

Piece 1 : (11,11) and (30,30)

In your example, we get $641 = 19^2 + 19^2 - 9 ^2$.