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: interview

Starter code:

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

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)


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())

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




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=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)

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

# Guide:
#   1. construct complex data types while reading (e.g. graph adj list)
#   2. avoid any non-necessary time/memory usage
#   3. avoid templates and write more from scratch
#   4. switch to "flat" implementations

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): # input matrix of integers
    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): # input matrix of strings
    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): # input transposed matrix/array of integers
    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()

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

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


#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""
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)


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


n=int(input())

m=0

for i in range(n):

	a,b,c,d=map(int,input().split())
	m+=(c-a+1)*(d-b+1)
print(m)

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

from heapq import heapify, heappush, heappop
from collections import Counter, defaultdict, deque, OrderedDict
from sys import setrecursionlimit, maxsize
from bisect import bisect_left, bisect, insort_left, insort
from math import ceil, log, factorial, hypot, pi
from fractions import gcd
from copy import deepcopy
from functools import reduce
from operator import mul
from itertools import product, permutations, combinations, accumulate, cycle
from string import ascii_uppercase, ascii_lowercase, ascii_letters, digits, hexdigits, octdigits

prod = lambda l: reduce(mul, l)
prodmod = lambda l, mod: reduce(lambda x, y: mul(x,y)%mod, l)

def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input()) for _ in range(N)]

N = read_line(int)
ans = 0
for i in range(N):
    x1, y1, x2, y2 = read_list(int)
    ans += (x2-x1+1) * (y2-y1+1)
print(ans)


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

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

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)

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)

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)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

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)


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)

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)


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


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


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

__starting_point()