#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#define MAXN 100

using namespace std;

int N;
struct rectangle {
    int sx, sy, ex, ey;
} rec[MAXN + 1];
int xs[MAXN * 2 + 1], ys[MAXN * 2 + 1]; 
int area = 0;

void input() {
    scanf("%d\n", &N);
    int i;
    for(i = 1; i <= N; i++) {
        scanf("%d %d %d %d\n", &rec[i].sx, &rec[i].sy, &rec[i].ex, &rec[i].ey);

        //xs 배열에 x 좌표만, ys 배열에 y 좌표만 저장
        //xs[0], ys[0]에는 좌표의 갯수
        xs[0]++, xs[xs[0]] = rec[i].sx;
        xs[0]++, xs[xs[0]] = rec[i].ex;
        ys[0]++, ys[ys[0]] = rec[i].sy;
        ys[0]++, ys[ys[0]] = rec[i].ey;
    }
}

void proc() {
    sort(&xs[1], &xs[1]+xs[0]);
    sort(&ys[1], &ys[1]+ys[0]);

    int i, j, k;
    for(i = 1; i < xs[0]; i++) {
        int sx = xs[i], ex = xs[i + 1];
        for(j = 1; j < ys[0]; j++) {
            int sy = ys[j], ey = ys[j + 1];
            //쪼개진 사각형이 입력데이터로 들어온 사각형들 내부에 포함되어 있는지 확인
            for(k = 1; k <= N; k++) {
                if(rec[k].sx <= sx && ex <= rec[k].ex && rec[k].sy <= sy && ey <= rec[k].ey) break;
            }
            //포함되어 있다면, 그 쪼개진 사각형을 면적에 누적
            if(k <= N) area += (ex - sx) * (ey - sy);
        }
    }
}

void output()
{
    printf("%d", area);
}

int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);

    input();
    proc();
    output();

    return 0;
}