Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. 

In this table, Vanya chose n 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.


-----Input-----

The first line contains integer n (1 ≤ n ≤ 100) — the number of rectangles.

Each of the following n lines contains four integers x_1, y_1, x_2, y_2 (1 ≤ x_1 ≤ x_2 ≤ 100, 1 ≤ y_1 ≤ y_2 ≤ 100), where x_1 and y_1 are the number of the column and row of the lower left cell and x_2 and y_2 are the number of the column and row of the upper right cell of a rectangle.


-----Output-----

In a single line print the sum of all values in the cells of the table.


-----Examples-----
Input
2
1 1 2 3
2 2 3 3

Output
10

Input
2
1 1 3 3
1 1 3 3

Output
18



-----Note-----

Note to the first sample test:

Values of the table in the first three rows and columns will be as follows:

121

121

110

So, the sum of values will be equal to 10.

Note to the second sample test:

Values of the table in the first three rows and columns will be as follows:

222

222

222

So, the sum of values will be equal to 18.

Difficulty: EASY

Solutions:
c = int(input())
r = []
for i in range(c):
	r.append(tuple([int(x) for x in input().split()]))
sum = 0
for i in r:
	for y in range(i[1], i[3] + 1):
		for x in range(i[0], i[2] + 1):
			sum += 1
print(sum)


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf
from bisect import bisect_right, bisect_left
cases = int(input())
mx = [[0 for i in range(101)] for j in range(1001)]
for _ in range(cases):
	(x1, y1, x2, y2) = map(int, input().split())
	for x in range(x1 - 1, x2):
		for y in range(y1 - 1, y2):
			mx[x][y] += 1
ans = 0
for row in mx:
	ans += sum(row)
print(ans)


t = int(input())
ans = 0
while t > 0:
	t -= 1
	(x1, y1, x2, y2) = map(int, input().split())
	ans += (x2 - x1 + 1) * (y2 - y1 + 1)
print(ans)


n = int(input())
s = 0
s = [0] * 101
for r in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(x1, x2 + 1):
		s[i] = s[i] + (y2 - y1 + 1)
sum_ = 0
for i in range(len(s)):
	sum_ = sum_ + s[i]
print(sum_)


n = int(input())
ans = 0
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	ans += (x2 - x1 + 1) * (y2 - y1 + 1)
print(ans)


r = 0
for i in range(int(input())):
	(x1, y1, x2, y2) = list(map(int, input().split()))
	r = r + (x2 - x1 + 1) * (y2 - y1 + 1)
print(r)


from sys import stdin
n = int(stdin.readline())
area = 0
for _ in range(n):
	(x1, y1, x2, y2) = map(int, stdin.readline().split())
	a = y2 - y1 + 1
	b = x2 - x1 + 1
	area += a * b
print(area)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()
	aa = [LI() for _ in range(n)]
	r = 0
	for (a, b, c, d) in aa:
		r += (c - a + 1) * (d - b + 1)
	return r
print(main())


import sys
import math
import bisect

def main():
	A = []
	for i in range(100):
		A.append([0] * 100)
	for _ in range(int(input())):
		(x1, y1, x2, y2) = map(int, input().split())
		x1 -= 1
		y1 -= 1
		x2 -= 1
		y2 -= 1
		for i in range(x1, x2 + 1):
			for j in range(y1, y2 + 1):
				A[i][j] += 1
	ans = 0
	for i in range(len(A)):
		ans += sum(A[i])
	print(ans)
main()


n = int(input())
count = 0
for i in range(n):
	(x1, y1, x2, y2) = list(map(int, input().split()))
	count += (x2 - x1 + 1) * (y2 - y1 + 1)
print(count)


def __starting_point():
	n = int(input())
	total = 0
	for i in range(n):
		(x1, y1, x2, y2) = map(int, input().split())
		w = abs(x1 - x2) + 1
		h = abs(y1 - y2) + 1
		total += w * h
	print(total)
__starting_point()


n = input()
n = int(n)
ans = 0
for i in range(n):
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	ans = ans + (c - a + 1) * (d - b + 1)
print(ans)


def table(lst):
	result = 0
	for elem in lst:
		result += (elem[2] - elem[0] + 1) * (elem[3] - elem[1] + 1)
	return result
n = int(input())
a = list()
for i in range(n):
	(x1, y1, x2, y2) = [int(j) for j in input().split()]
	a.append([x1, y1, x2, y2])
print(table(a))


n = int(input())
p = 0
for i in range(n):
	s = input()
	s = s.split(' ')
	x = (int(s[2]) - int(s[0]) + 1) * (int(s[3]) - int(s[1]) + 1)
	p += x
print(p)


n = int(input())
s = 0
for i in range(n):
	a = [int(i) for i in input().split()]
	s += (a[2] - a[0] + 1) * (a[3] - a[1] + 1)
print(s)


class Rectangle:

	def __init__(self, coord):
		self.x1 = coord[0]
		self.y1 = coord[1]
		self.x2 = coord[2]
		self.y2 = coord[3]

	def Have(self, x, y):
		if self.x1 <= x <= self.x2 and self.y1 <= y <= self.y2:
			return True
		else:
			return False
n = int(input())
rectangles = []
for i in range(n):
	rectangles.append(Rectangle([int(j) for j in input().split()]))
sum = 0
for i in range(100):
	for j in range(100):
		for rectangle in rectangles:
			if rectangle.Have(i + 1, j + 1):
				sum += 1
print(sum)


n = int(input())
arr = [[0 for x in range(100)] for y in range(100)]
for i in range(0, n):
	inp = [int(i) for i in input().split()]
	x1 = inp[0] - 1
	y1 = inp[1] - 1
	x2 = inp[2] - 1
	y2 = inp[3] - 1
	for x in range(x1, x2 + 1):
		for y in range(y1, y2 + 1):
			arr[x][y] = arr[x][y] + 1
sum = 0
for x in range(0, 100):
	for y in range(0, 100):
		sum += arr[x][y]
print(sum)


s = [[0] * 100 for k in range(100)]
k = 0
n = int(input())
s1 = [list(map(int, input().split())) for j in range(n)]
for i in range(len(s1)):
	for i1 in range(s1[i][0], s1[i][2] + 1):
		for i2 in range(s1[i][1], s1[i][3] + 1):
			k += 1
print(k)


n = int(input())
t = 0
for i in range(n):
	a = list(map(int, input().split()))
	t = t + (a[2] - a[0] + 1) * (a[3] - a[1] + 1)
print(t)


n = int(input())
grid = [0] * 100 ** 2
for row in range(n):
	(x1, y1, x2, y2) = [int(x) for x in input().split(' ')]
	for i in range(x1 - 1, x2):
		for j in range(y1 - 1, y2):
			grid[n * i + j] += 1
print(sum(grid))


arr = []
for x in range(100):
	arr.append([])
	arr[x] = [0 for i in range(100)]
n = int(input())
ans = 0
for x in range(n):
	(a, b, c, d) = map(int, input().split())
	ans = ans + (c - a + 1) * (d - b + 1)
print(ans)


n = int(input())
s = 0
for _ in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	s = s + abs(x2 - x1 + 1) * abs(y2 - y1 + 1)
print(s)


print(sum(map(lambda a: -~(a[2] - a[0]) * -~(a[3] - a[1]), (list(map(int, input().split())) for i in range(int(input()))))))


from collections import deque
n = int(input())
a = [[0 for j in range(100)] for i in range(100)]
for t in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(x1 - 1, x2):
		for j in range(y1 - 1, y2):
			a[i][j] += 1
sum = 0
for i in range(100):
	for j in range(100):
		sum += a[i][j]
print(sum)


res = 0
for i in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	res += (x2 - x1 + 1) * (y2 - y1 + 1)
print(res)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict, deque

def VI():
	return list(map(int, input().split()))

def I():
	return int(input())

def LIST(n, m=None):
	return [0] * n if m is None else [[0] * m for i in range(n)]

def ELIST(n):
	return [[] for i in range(n)]

def MI(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = VI()
	return arr

def MS(n=None, m=None):
	if n is None:
		(n, m) = VI()
	arr = LIST(n)
	for i in range(n):
		arr[i] = input()
	return arr

def MIT(n=None, m=None):
	if n is None:
		(n, m) = VI()
	a = MI(n, m)
	arr = LIST(m, n)
	for (i, l) in enumerate(a):
		for (j, x) in enumerate(l):
			arr[j][i] = x
	return arr

def run(n, x, l, r):
	s = 0
	curr = 1
	for i in range(n):
		skip = (l[i] - curr) // x
		s += r[i] - curr - skip * x + 1
		curr = r[i] + 1
	print(s)

def main(info=0):
	n = I()
	ans = 0
	for i in range(n):
		x = VI()
		ans += (x[2] - x[0] + 1) * (x[3] - x[1] + 1)
	print(ans)

def __starting_point():
	main()
__starting_point()


a = int(input())
summ = 0
for i in range(a):
	p = [int(x) for x in input().split()]
	summ += (p[2] - p[0] + 1) * (p[3] - p[1] + 1)
print(summ)


def main():
	n = int(input())
	dct = {}
	for i in range(n):
		(x1, y1, x2, y2) = map(int, input().split())
		(x_c, y_c) = (x1, y1)
		while y_c <= y2:
			x_c = x1
			while x_c <= x2:
				if (x_c, y_c) in dct:
					dct[x_c, y_c] += 1
				else:
					dct[x_c, y_c] = 1
				x_c += 1
			y_c += 1
	return sum(dct.values())
print(main())


def build():
	arr = []
	for i in range(100):
		arr.append([0] * 100)
	return arr

def solve(arr):
	res = build()
	for (i, v) in enumerate(arr):
		for row in range(v[2] - (v[0] - 1)):
			for col in range(v[3] - (v[1] - 1)):
				res[row][col] += 1
	tot = 0
	for i in res:
		tot += sum(i)
	return tot

def main():
	n = int(input())
	arr = []
	for _ in range(n):
		i = list(map(int, input().split(' ')))
		arr.append(i)
	print(solve(arr))
main()


n = int(input())
ans = 0
for i in range(n):
	(x, y, x1, y1) = map(int, input().split())
	ans += (x1 - x + 1) * (y1 - y + 1)
print(ans)


n = int(input())
sum = 0
for i in range(n):
	(x1, y1, x2, y2) = [int(a) for a in input().split()]
	sum += (x2 - x1 + 1) * (y2 - y1 + 1)
print(sum)


n = int(input())
r = []
for i in range(n):
	r.append(tuple(map(int, input().split())))
m = [[0] * 100 for i in range(100)]
for i in r:
	(x1, y1, x2, y2) = i
	for y in range(100 - y1, 100 - y2 - 1, -1):
		for x in range(100 - x1, 100 - x2 - 1, -1):
			m[y][x] += 1
s = 0
for i in m:
	s += sum(i)
print(s)


def proA(arr):
	ans = 0
	for i in arr:
		(x, y, a, b) = i
		ans += (a - x + 1) * (b - y + 1)
	return ans
arr = []
t = int(input())
for i in range(t):
	arr.append(list(map(int, input().split())))
print(proA(arr))


n = int(input())
res = 0
for i in range(n):
	(a, b, c, d) = map(int, input().split(' '))
	res += (abs(a - c) + 1) * (abs(b - d) + 1)
print(res)


__author__ = 'victormion'
rectangles = []
n = int(input())
for i in range(n):
	(a, b, c, d) = input().strip().split()
	rectangles.append((int(a), int(b), int(c), int(d)))
sum = 0
for i in range(1, 101):
	for j in range(1, 101):
		for rect in rectangles:
			if rect[0] <= i <= rect[2] and rect[1] <= j <= rect[3]:
				sum += 1
print(sum)


n = int(input())
r = []
a = 0
for i in range(n):
	r.append(input().split())
	a += (int(r[i][2]) - int(r[i][0]) + 1) * (int(r[i][3]) - int(r[i][1]) + 1)
print(a)


def calc(x0, y0, x1, y1):
	return (abs(x0 - x1) + 1) * (abs(y0 - y1) + 1)
n = int(input())
print(sum((calc(*map(int, input().split())) for i in range(0, n))))


n = int(input())
s = 0
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	s += (c - a + 1) * (d - b + 1)
print(s)


n = int(input())
maxn = 100
d = [[0] * maxn for i in range(maxn)]
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	x1 -= 1
	x2 -= 1
	y1 -= 1
	y2 -= 1
	for i in range(x1, x2 + 1):
		for j in range(y1, y2 + 1):
			d[i][j] += 1
sum = 0
for i in range(maxn):
	for j in range(maxn):
		sum += d[i][j]
print(sum)


N = int(input())
sum = 0
for i in range(N):
	arr = list(map(int, input().split()))
	sum += (arr[2] - arr[0] + 1) * (arr[3] - arr[1] + 1)
print(sum)


from sys import stdin
import math
n = int(stdin.readline())
res = 0
for i in range(0, n):
	(x1, y1, x2, y2) = map(int, stdin.readline().split())
	res += int(math.fabs(x1 - x2) + 1) * int(math.fabs(y1 - y2) + 1)
print(res)


t = 0
n = int(input())
for i in range(n):
	(x1, y1, x2, y2) = [int(i) for i in input().split()]
	t += (x2 - x1 + 1) * (y2 - y1 + 1)
print(t)


def count(coord: list, _list: list) -> list:
	for i in range(coord[0] - 1, coord[2]):
		for j in range(coord[1] - 1, coord[3]):
			_list[i][j] += 1
rec_num = int(input())
rec_list = []
maxi = 0
for i in range(rec_num):
	rec_list.append(input().split(' '))
	for j in range(4):
		rec_list[i][j] = int(rec_list[i][j])
	current_maxi = max(rec_list[i])
	maxi = max(maxi, current_maxi)
rec_table = []
for i in range(maxi):
	rec_table.append([])
	for j in range(maxi):
		rec_table[i].append(0)
for i in range(rec_num):
	count(rec_list[i], rec_table)
ans = 0
for i in range(maxi):
	for j in range(maxi):
		ans = ans + rec_table[i][j]
print(ans)


sum = 0
for i in range(int(input())):
	a = [int(x) for x in input().split(' ')]
	sum += (a[2] - a[0] + 1) * (a[3] - a[1] + 1)
print(sum)


reps = int(input())
total = 0
for i in range(0, reps):
	points = [int(n) for n in input().split()]
	xWidth = points[2] - points[0] + 1
	yHeight = points[3] - points[1] + 1
	total += xWidth * yHeight
print(total)


a = [[0 for i in range(100)] for j in range(100)]
for cas in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(x1 - 1, x2):
		for j in range(y1 - 1, y2):
			a[i][j] += 1
ans = 0
for l in a:
	ans += sum(l)
print(ans)


(t, n) = (0, int(input()))
for i in range(0, n):
	(a, b, c, d) = map(int, input().split())
	t += (c - a + 1) * (d - b + 1)
print(t)


z = []
s = 0
for i in ' ' * int(input()):
	(a, b, c, d) = list(map(int, input().split()))
	s += (c - a + 1) * (d - b + 1)
print(s)


n = int(input())
res = 0
for j in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	res += (x2 - x1 + 1) * (y2 - y1 + 1)
print(res)


__author__ = 'taras-sereda'

def vanja_table():
	num_rows = int(input())
	res = 0
	for i in range(num_rows):
		(x1, y1, x2, y2) = map(int, input().split())
		res += (x2 - x1 + 1) * (y2 - y1 + 1)
	return res
print(vanja_table())


import time
n = int(input())
ans = 0
for k in range(n):
	(x1, y1, x2, y2) = (int(i) for i in input().split())
	ans += (x2 - x1 + 1) * (y2 - y1 + 1)
start = time.time()
print(ans)
finish = time.time()


c = 0
for _ in range(int(input())):
	(x1, y1, x2, y2) = map(int, str.split(input()))
	c += (x2 - x1 + 1) * (y2 - y1 + 1)
print(c)


r = [[0] * 110 for _ in range(110)]
for _ in range(int(input())):
	(x, y, X, Y) = map(int, input().split())
	for i in range(x, X + 1):
		for j in range(y, Y + 1):
			r[i][j] += 1
print(sum(map(sum, r)))


sum = 0
for _ in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	sum += (c - a + 1) * (d - b + 1)
print(sum)


import sys
n = int(input())
ans = 0
for _ in range(n):
	(x1, y1, x2, y2) = map(int, sys.stdin.readline().split())
	ans += (x2 + 1 - x1) * (y2 + 1 - y1)
print(ans)


(n, s) = (int(input()), 0)
for i in range(n):
	(x1, y1, x2, y2) = [int(x) for x in input().split()]
	s = s + (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1)
print(s)


__author__ = 'Andrey'
n = int(input())
s = 0
for i in range(n):
	(x_1, y_1, x_2, y_2) = map(int, input().split())
	s += (x_2 - x_1 + 1) * (y_2 - y_1 + 1)
print(s)


n = int(input())
sm = 0
for _ in range(n):
	(x, y, xx, yy) = map(int, input().split())
	sm += (xx - x + 1) * (yy - y + 1)
print(sm)


n = int(input())
s = 0
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	s += (c - a + 1) * (d - b + 1)
print(s)


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
mat = [[0 for i in range(100)] for i in range(100)]
n = int(input())
while n > 0:
	(x1, y1, x2, y2) = get_ints()
	x1 = abs(100 - x1)
	x2 = abs(100 - x2)
	y1 -= 1
	y2 -= 1
	mini = min(x1, x2)
	maxi = max(x1, x2)
	for i in range(mini, maxi + 1):
		for j in range(y1, y2 + 1):
			mat[i][j] += 1
	n -= 1
total = 0
for i in range(100):
	for j in range(100):
		total += mat[i][j]
print(total)


n = int(input())
s = 0
for i in range(n):
	li = [int(j) for j in input().split()]
	s += (abs(li[2] - li[0]) + 1) * (abs(li[3] - li[1]) + 1)
print(s)


n = int(input())
t = [[0] * 100] * 100
for i in range(n):
	s = [int(x) for x in input().split(' ')]
	a = (s[0], s[1])
	b = (s[2], s[3])
	for j in range(a[0] - 1, b[0]):
		for k in range(a[1] - 1, b[1]):
			t[j][k] += 1
print(sum([sum(x) for x in t]) // 100)


number_of_rect = int(input())
rectangles = []
for _ in range(number_of_rect):
	(_x1, _y1, _x2, _y2) = list(map(int, input().split()))
	zipped_x_y = list(zip((_x1, _x2), (_y1, _y2)))
	rectangles.append(zipped_x_y)
	zipped_x_y = []

def rectangle_counter(*rects_arg):
	rect_quantity = 0
	for rect in rects_arg:
		temp_rect_quantity = (rect[1][0] - rect[0][0] + 1) * (rect[1][1] - rect[0][1] + 1)
		rect_quantity += temp_rect_quantity
	return rect_quantity
print(rectangle_counter(*rectangles))


x = []
tt = int(input())
for i in range(tt):
	(a, b, c, d) = list(map(int, input().split(' ')))
	x.append([a, b, c, d])
ct = 0
for a in range(1, 101):
	for b in range(1, 101):
		for i in x:
			(a1, a2, a3, a4) = (i[0], i[1], i[2], i[3])
			if a1 <= a <= a3 and a2 <= b <= a4:
				ct += 1
print(ct)


n = int(input())
a = []
for i in range(100):
	a.append([0 for j in range(100)])
for ii in range(n):
	(y1, x1, y2, x2) = list(map(int, input().split()))
	for i in range(y1 - 1, y2):
		for j in range(x1 - 1, x2):
			a[i][j] += 1
ans = 0
for ii in a:
	ans += sum(ii)
print(ans)


r = lambda : list(map(int, input().split()))
n = int(input())
c = lambda x: (x[2] - x[0] + 1) * (x[3] - x[1] + 1)
total = sum((c(r()) for _ in range(n)))
print(total)


n = int(input())
ret = 0
for _ in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	ret += (x2 - x1 + 1) * (y2 - y1 + 1)
print(ret)


n = int(input())
sum = 0
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split(' '))
	sum += abs(x2 - x1 + 1) * (y2 - y1 + 1)
print(sum)


rect = [[0] * 100 for i in range(100)]

def fill(x1, y1, x2, y2):
	global rect
	for i in range(x1 - 1, x2):
		for j in range(y1 - 1, y2):
			rect[i][j] += 1
for _ in range(int(input().strip())):
	(x1, y1, x2, y2) = map(int, input().strip().split())
	fill(x1, y1, x2, y2)
s = 0
for row in rect:
	s += sum(row)
print(s)


n = int(input())
answer = 0
for i in range(n):
	(yo, xo, yt, xt) = map(int, input().split())
	answer += (yt - yo + 1) * (xt - xo + 1)
print(answer)


ans = 0
for _ in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	ans += (y2 - y1 + 1) * (x2 - x1 + 1)
print(ans)


(MaxColumn, MaxRow) = (0, 0)
Size = int(input())
Rectangles = list()
for i in range(Size):
	Temp = list(map(int, input().split()))
	MaxColumn = max(MaxColumn, Temp[3])
	MaxRow = max(MaxRow, Temp[2])
	Rectangles.append(Temp)
Table = list()
for i in range(MaxRow):
	Table.append([0 for j in range(MaxColumn)])
for i in range(Size):
	for Row in range(Rectangles[i][0], Rectangles[i][2] + 1):
		for Col in range(Rectangles[i][1], Rectangles[i][3] + 1):
			Table[Row - 1][Col - 1] += 1
print(sum((sum(i) for i in Table)))


rects = int(input())
s = 0
for _ in range(rects):
	(x1, y1, x2, y2) = map(int, input().split())
	s += (x2 - x1 + 1) * (y2 - y1 + 1)
print(s)


n = int(input())
M = [list(map(int, input().split())) for _ in range(n)]
T = [[0 for _ in range(100)] for _ in range(100)]
for k in range(n):
	R = M[k]
	for i in range(R[0] - 1, R[2]):
		for j in range(R[1] - 1, R[3]):
			T[i][j] += 1
print(sum([sum(T[i]) for i in range(100)]))


withFile = 0
if withFile == 1:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')

def getl():
	if withFile == 0:
		return input()
	else:
		return fin.readline()

def printl(s):
	if withFile == 0:
		print(s)
	else:
		fout.write(str(s))

def get_arr():
	x = getl().split(' ')
	if x[-1] == '':
		x = x[:-1]
	return list(map(int, x))
f = [[0 for y in range(101)] for x in range(101)]
n = get_arr()
n = n[0]
for i in range(n):
	a = get_arr()
	(x1, y1, x2, y2) = (a[0], a[1], a[2], a[3])
	for x in range(x1, x2 + 1):
		for y in range(y1, y2 + 1):
			f[x][y] += 1
s = 0
for x in f:
	s += sum(x)
printl(s)
if withFile == 1:
	fin.close()
	fout.close()


a = [[0 for i in range(101)] for j in range(101)]
n = int(input())
for ii in range(n):
	(y1, x1, y2, x2) = map(int, input().split())
	for i in range(y1, y2 + 1):
		for j in range(x1, x2 + 1):
			a[i][j] += 1
ans = 0
for ii in a:
	ans += sum(ii)
print(ans)


def table(a):
	sum = 0
	for i in range(len(a)):
		arr = a[i]
		x = arr[2] - arr[0] + 1
		y = arr[3] - arr[1] + 1
		sum += x * y
	print(sum)
n = int(input(''))
a = []
for i in range(n):
	b = list(map(int, input('').split()))
	a.append(b)
table(a)


n = int(input())
m = []
che = 0
for i in range(100):
	m.append([0] * 100)
for g in range(n):
	(x, y, xx, yy) = map(int, input().split())
	for i in range(x - 1, xx):
		for j in range(y - 1, yy):
			m[j][i] += 1
for i in range(100):
	for j in range(100):
		che += m[j][i]
print(che)


n = int(input())
sum = 0
for i in range(n):
	l = [int(j) for j in input().split()]
	sum += (l[2] - l[0] + 1) * (l[3] - l[1] + 1)
print(sum)


n = int(input())
a = []
for i in range(100):
	a.append([])
	for j in range(100):
		a[i].append(0)
for i in range(n):
	(x1, y1, x2, y2) = [int(x) for x in input().split()]
	for t in range(x1 - 1, x2):
		for k in range(y1 - 1, y2):
			a[t][k] += 1
num = 0
for i in range(100):
	num += sum(a[i])
print(num)


def ha(pos, pos1):
	co = 0
	for i in range(len(pos1)):
		if pos1[i][2] >= pos[0] >= pos1[i][0]:
			if pos1[i][3] >= pos[1] >= pos1[i][1]:
				co += 1
	return co
n = int(input())
rec = []
rec1 = []
x = []
y = []
for i in range(n):
	rec += [[int(x) - 1 for x in input().split(' ')]]
m = 0
for i in range(100):
	for l in range(100):
		m += ha([i, l], rec)
print(m)


R = lambda : list(map(int, input().split()))
cnt = [[0 for i in range(101)] for j in range(101)]
n = R()[0]
for _ in range(n):
	(x1, y1, x2, y2) = R()
	for x in range(x1, x2 + 1):
		for y in range(y1, y2 + 1):
			cnt[x][y] += 1
print(sum((sum(i) for i in cnt)))


L = [[0] * 100] * 100
n = int(input())
for k in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	y = y1
	for j in range(y1 - 1, y2):
		for i in range(x1 - 1, x2):
			L[j][i] += 1
suma = 0
for k in range(100):
	for j in range(100):
		suma += L[k][j]
print(suma // 100)


import math
n = int(input())
x = []
r = 0
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split())
	r += (c - a + 1) * (d - b + 1)
print(r)


n = int(input())
result = 0
for i in range(n):
	rec = [int(j) for j in input().split()]
	result += (rec[2] - rec[0] + 1) * (rec[3] - rec[1] + 1)
print(result)


n = int(input())

def inp(s):
	j = 0
	a = []
	for i in range(len(s)):
		if s[i] == ' ':
			a.append(int(s[j:i]))
			j = i + 1
		if i == len(s) - 1:
			a.append(int(s[j:]))
	return a
i = 0
for j in range(n):
	s = input()
	a = inp(s)
	t = (a[2] - a[0] + 1) * (a[3] - a[1] + 1)
	i = i + t
print(i)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
n = iinput()
s = 0
for i in range(n):
	(x1, y1, x2, y2) = rinput()
	s += (x2 - x1 + 1) * (y2 - y1 + 1)
print(s)


class CodeforcesTask552ASolution:

	def __init__(self):
		self.result = ''
		self.rects = []

	def read_input(self):
		rect_count = int(input())
		for x in range(rect_count):
			self.rects.append([int(x) for x in input().split(' ')])

	def process_task(self):
		table = [[0 for x in range(100)] for y in range(100)]
		for rect in self.rects:
			for x in range(rect[0], rect[2] + 1):
				for y in range(rect[1], rect[3] + 1):
					table[x - 1][y - 1] += 1
		table_sum = 0
		for row in table:
			for cell in row:
				table_sum += cell
		self.result = str(table_sum)

	def get_result(self):
		return self.result
Solution = CodeforcesTask552ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


import itertools as ittls
from collections import Counter
import string

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
s = 0
for _ in range(N):
	(x1, y1, x2, y2) = inputarray()
	s = s + (x2 - x1 + 1) * (y2 - y1 + 1)
print(s)


n = int(input())
l = []
for i in range(100):
	l.append([0] * 100)
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	x1 += -1
	x2 += -1
	y1 += -1
	y2 += -1
	for i in range(x1, x2 + 1):
		for j in range(y1, y2 + 1):
			l[i][j] -= -1
ans = 0
for i in range(100):
	for j in range(100):
		ans += l[i][j]
print(ans)


n = int(input())
points = []
for i in range(0, n):
	points.append(list(map(int, input().split())))
nrt = 0
for p in points:
	nrt += (abs(p[3] - p[1]) + 1) * (abs(p[2] - p[0]) + 1)
print(nrt)


n = int(input())
answer = 0
for i in range(n):
	coords = input().split()
	x1 = int(coords[0])
	y1 = int(coords[1])
	x2 = int(coords[2])
	y2 = int(coords[3])
	answer = answer + (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1)
print(answer)


n = int(input())
t = 0
for _ in range(n):
	l_c = list(map(int, input().split()))
	t += (abs(l_c[0] - l_c[2]) + 1) * (abs(l_c[1] - l_c[3]) + 1)
print(t)


n = int(input())
res = 0
for i in range(n):
	(x1, y1, x2, y2) = [int(x) for x in input().split()]
	res += (x2 - x1 + 1) * (y2 - y1 + 1)
print(res)


n = int(input())
table = []
for i in range(100):
	table.append([0] * 100)
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for j in range(x1 - 1, x2):
		for k in range(y1 - 1, y2):
			table[i][j] += 1
ans = 0
for i in range(100):
	ans += sum(table[i])
print(ans)


n = int(input())
ll = [list(map(int, input().split())) for _ in range(n)]
print(sum([(l[2] - l[0] + 1) * (l[3] - l[1] + 1) for l in ll]))


n = int(input())
res = 0
i = 0
while i < n:
	(a, b, c, d) = map(int, input().split())
	res += (c - a + 1) * (d - b + 1)
	i += 1
print(res)


s = 0
for i in range(int(input())):
	l = list(map(int, input().split()))
	sq = (l[2] - l[0] + 1) * (l[3] - l[1] + 1)
	s += sq
print(s)


n = int(input())
s = 0
for i in range(n):
	a = str(input()).split()
	x1 = int(a[0])
	y1 = int(a[1])
	x2 = int(a[2])
	y2 = int(a[3])
	s += (x2 - x1 + 1) * (y2 - y1 + 1)
print(s)


a = int(input())
b = []
for i in range(a):
	b.append(list(map(int, input().split())))
p = 0
for i in b:
	p = p + (abs(i[2] - i[0]) + 1) * (abs(i[3] - i[1]) + 1)
print(p)


area = lambda x1, y1, x2, y2: (x2 - x1 + 1) * (y2 - y1 + 1)
print(sum((area(*map(int, input().split())) for _ in range(int(input())))))


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	m = [[0 for x in range(100)] for y in range(100)]
	for i in range(n):
		(x1, y1, x2, y2) = map(int, input().split())
		for x in range(x1, x2 + 1):
			for y in range(y1, y2 + 1):
				m[x - 1][y - 1] += 1
	summ = 0
	for x in m:
		summ += sum(x)
	print(summ)
for _ in range(1):
	solve()


n = int(input().strip())
p = []
k = 0
for i in range(n):
	p.append(list(map(int, input().split())))
	k += (p[len(p) - 1][2] - p[len(p) - 1][0] + 1) * (p[len(p) - 1][3] - p[len(p) - 1][1] + 1)
print(k)


n = int(input())
a = [[0 for j in range(101)] for i in range(101)]
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for x in range(x1, x2 + 1):
		for y in range(y1, y2 + 1):
			a[x][y] += 1
print(sum([sum(lst) for lst in a]))


n = int(input())
M = []
for i in range(101):
	M.append([0] * 101)
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().strip().split(' '))
	for j in range(abs(x2 - x1) + 1):
		for k in range(abs(y2 - y1) + 1):
			M[j][k] += 1
s = 0
for i in range(101):
	for j in range(101):
		s = s + M[i][j]
print(s)


n = int(input())
d = {}
for i in range(1, 101):
	for j in range(1, 101):
		d[i, j] = 0
for _ in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(x1, x2 + 1):
		for j in range(y1, y2 + 1):
			d[i, j] += 1
count = 0
for i in d:
	count += d[i]
print(count)


k = 0
for _ in range(int(input())):
	(x1, y1, x2, y2) = input().split()
	k += (int(x2) - int(x1) + 1) * (int(y2) - int(y1) + 1)
print(k)


value = 0
n = int(input())
for i in range(n):
	(x1, y1, x2, y2) = str(input()).split()
	value += (int(x2) - int(x1) + 1) * (int(y2) - int(y1) + 1)
print(value)


n = int(input())
matrix = [[0] * 100 for i in range(100)]
for t in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(y1 - 1, y2):
		for j in range(x1 - 1, x2):
			matrix[i][j] += 1
answer = 0
for row in matrix:
	answer += sum(row)
print(answer)


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readintarr(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writearr(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
n = readint()
s = 0
for _ in range(n):
	(x1, y1, x2, y2) = readintarr()
	s += (abs(x2 - x1) + 1) * (abs(y2 - y1) + 1)
write(s)


sum = 0
N = int(input())
for i in range(N):
	(x1, y1, x2, y2) = tuple((int(i) for i in input().split()))
	sum += (x2 - x1 + 1) * (y2 - y1 + 1)
print(sum)


n = int(input())
v = 0
for i in range(n):
	(a, b, x, y) = map(int, input().split())
	v += (x - a + 1) * (y - b + 1)
print(v)


def main():
	res = 0
	for _ in range(int(input())):
		(a, b, c, d) = map(int, input().split())
		res += (c - a + 1) * (d - b + 1)
	print(res)
main()


mat = [None] * 101
for i in range(101):
	mat[i] = [0] * 101
for i in range(int(input())):
	(x, y, a, b) = map(int, input().split())
	for n in range(x, a + 1):
		for m in range(y, b + 1):
			mat[n][m] += 1
ans = 0
for i in range(101):
	ans += sum(mat[i])
print(ans)


n = int(input())
c = [list(map(int, input().split())) for _ in range(n)]
g = [[0 for j in range(101)] for i in range(101)]
for v in c:
	for i in range(v[0], v[2] + 1):
		for j in range(v[1], v[3] + 1):
			g[i][j] += 1
print(sum((sum(v) for v in g)))


n = int(input())
mas = []
for i in range(n):
	mas.append([int(x) for x in input().split(' ')])
b = 0
for j in range(n):
	b = b + (mas[j][2] - mas[j][0] + 1) * (mas[j][3] - mas[j][1] + 1)
print(b)


total = 0
for _ in range(int(input().strip())):
	(x1, y1, x2, y2) = map(int, input().strip().split())
	total += (x2 - x1 + 1) * (y2 - y1 + 1)
print(total)


N = int(input())
res = 0
for i in range(N):
	(x, y, x2, y2) = map(int, input().split())
	res += (x2 - x + 1) * (y2 - y + 1)
print(res)


g = [0] * 105 * 105
n = int(input())
for k in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for i in range(y1, y2 + 1):
		for j in range(x1, x2 + 1):
			g[i * 105 + j] += 1
print(sum(g))


import sys
n = int(sys.stdin.readline())
s = 0
for i in range(n):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	s += (c - a + 1) * (d - b + 1)
sys.stdout.write(str(s))
sys.stdout.write('\n')


n = int(input())
b = [[0 for i in range(100)] for i in range(100)]
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	for j in range(x1 - 1, x2):
		for k in range(y1 - 1, y2):
			b[j][k] += 1
ans = 0
for p in range(100):
	for q in range(100):
		ans += b[p][q]
print(ans)


import unittest
import sys
import re
import random

class Table:
	N = 100

	def __init__(self, args):
		self.args = args
		self.starts = args[1]
		self.ends = args[2]
		self.table = [[0 for x in range(self.N + 2)] for y in range(self.N + 2)]

	def calculate(self):
		sum = 0
		for y in range(1, self.N + 2):
			for x in range(1, self.N + 2):
				for (start, end) in zip(self.starts, self.ends):
					inside = x >= start[0] and y >= start[1] and (x <= end[0]) and (y <= end[1])
					if inside:
						sum += 1
		return sum

def decode_inputs(inputs):
	num = int(inputs[0])
	ilist = [[int(n) for n in i.split()] for i in inputs[1:]]
	starts = [(rec[0], rec[1]) for rec in ilist]
	ends = [(rec[2], rec[3]) for rec in ilist]
	args = (num, starts, ends)
	return args

def calculate(inputs):
	return Table(decode_inputs(inputs)).calculate()

def main():
	n = input()
	squares = [input() for i in range(int(n))]
	inputs = tuple([n] + squares)
	print(calculate(inputs))

class unitTests(unittest.TestCase):

	def test_decode_inputs(self):
		self.assertEqual(decode_inputs(('2', '1 2 3 4', '5 6 7 8')), (2, [(1, 2), (5, 6)], [(3, 4), (7, 8)]))

	def test_Table_class__basic_functions(self):
		d = Table((1, [(1, 1)], [(2, 2)]))
		self.assertEqual(d.args[0], 1)
		self.assertEqual(d.table[100][100], 0)
		self.assertEqual(d.calculate(), 4)

	def test_calculate(self):
		self.assertEqual(calculate(('2', '1 1 2 3', '2 2 3 3')), 10)
		self.assertEqual(calculate(('2', '1 1 3 3', '1 1 3 3')), 18)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
main()


import math
import sys
n = int(input())
ans = 0
for i in range(0, n):
	inp = list(map(int, input().split()))
	x1 = inp[0]
	y1 = inp[1]
	x2 = inp[2]
	y2 = inp[3]
	X = x2 - x1 + 1
	Y = y2 - y1 + 1
	ans += X * Y
print(ans)


n = int(input())
an = 0
for i in range(n):
	(x, y, a, b) = map(int, input().split())
	area = (abs(x - a) + 1) * (abs(y - b) + 1)
	an += area
print(an)


r = 0
for s in [*open(0)][1:]:
	(a, b, c, d) = map(int, s.split())
	r += (c - a + 1) * (d - b + 1)
print(r)


n = int(input())
xy = [list(map(int, input().split())) for i in range(n)]
summ = 0
for i in range(n):
	summ += (xy[i][2] - xy[i][0] + 1) * (xy[i][3] - xy[i][1] + 1)
print(summ)


n = int(input())
coordinates = []
for x in range(n):
	string = input()
	numbers = string.split()
	for y in range(4):
		numbers[y] = int(numbers[y])
	rectangle = [numbers[0], numbers[1], numbers[2], numbers[3]]
	coordinates.append(rectangle)
a = max([x[3] for x in coordinates])
b = max([x[2] for x in coordinates])
cells = 0
for x in range(1, a + 1):
	for y in range(1, b + 1):
		for z in coordinates:
			if z[1] <= x <= z[3] and z[0] <= y <= z[2]:
				cells += 1
print(cells)


N = int(input())
ans = 0
for n in range(N):
	(i, j, a, b) = tuple(map(int, input().split(' ')))
	ans += (a - i + 1) * (b - j + 1)
print(ans)


n = int(input())
Sum = 0
for i in range(n):
	(x1, y1, x2, y2) = map(int, input().split())
	S = (x2 - x1 + 1) * (y2 - y1 + 1)
	Sum += S
print(Sum)


s = int(input())
sum = 0
while s > 0:
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	sum += (c - a + 1) * (d - b + 1)
	s -= 1
print(sum)


t = 0
for _ in range(int(input())):
	(x1, y1, x2, y2) = map(int, input().split())
	t += (abs(x2 - x1) + 1) * (abs(y2 - y1) + 1)
print(t)