eolymp
bolt
Try our new interface for solving problems
Problems

Three rectangles

Three rectangles

Three rectangles are painted on the white sheet of paper so that their sides lie on the grid lines and the vertices have integer coordinates. Find the total number of painted cells. \includegraphics{https://static.e-olymp.com/content/f9/f96dde145775c06574fd8c9b2e9099ca35856fd0.png} \InputFile Three lines contain four integers --- the coordinates of two opposite vertices of each rectangle (the coordinates do not exceed $100$ by absolute value). \OutputFile Print the number of painted cells.
Time limit 1 second
Memory limit 128 MiB
Input example #1
2 2 5 6
3 3 7 1
6 4 4 7
Output example #1
22
Source 2015 III этап Всеукраинской олимпиады по информатике в Житомирской обл.