#P4682. Vanya and Table
Vanya and Table
Vanya and Table
题面翻译
给定 个矩形,每一个矩形左上角坐标为 ,右下角坐标为 。(,)
求这 个矩形的面积。
translate by SYC0226
题目描述
Vanya has a table consisting of rows, each row contains cells. The rows are numbered by integers from to from bottom to top, the columns are numbered from to from left to right.
In this table, Vanya chose rectangles with sides that go along borders of squares (some rectangles probably occur multiple times). After that for each cell of the table he counted the number of rectangles it belongs to and wrote this number into it. Now he wants to find the sum of values in all cells of the table and as the table is too large, he asks you to help him find the result.
输入格式
The first line contains integer ( ) — the number of rectangles.
Each of the following lines contains four integers ( , , where and are the number of the column and row of the lower left cell and and are the number of the column and row of the upper right cell of a rectangle.
输出格式
In a single line print the sum of all values in the cells of the table.
样例 #1
样例输入 #1
2
1 1 2 3
2 2 3 3
样例输出 #1
10
样例 #2
样例输入 #2
2
1 1 3 3
1 1 3 3
样例输出 #2
18
提示
Note to the first sample test:
Values of the table in the first three rows and columns will be as follows:
So, the sum of values will be equal to .
Note to the second sample test:
Values of the table in the first three rows and columns will be as follows:
So, the sum of values will be equal to .