#include <iostream>
#include <cstdio>
using namespace std;
bool a[10005][10005]; //记录一个点是否被油漆涂过
int sum;

void paint(int x1, int y1, int x2, int y2)
{
    for (int i = x1; i < x2; i++)
    {
        for (int j = y1; j < y2; j++)
        {
            a[i][j] = 1; //涂上颜色
        }
    }
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x1, x2, y1, y2;
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        paint(x1, y1, x2, y2);
    }
    for (int i = 0; i < 10005; i++)
    {
        for (int j = 0; j < 10005; j++)
        {
            if (a[i][j])
                sum++; //面积增加
        }
    }
    printf("%d\n", sum);
    return 0;
}
