#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <deque>
#include <time.h>
#include <stack>
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <fstream>
#include <queue>
#define mp make_pair
#define pb push_back
#define PI 3.14159265358979323846
#define MOD 1000000007
#define INF ((ll)1e+15)
#define x1 fldgjdflgjhrthrl
#define x2 fldgjdflgrtyrtyjl
#define y1 fldggfhfghjdflgjl
#define y2 ffgfldgjdflgjl
typedef long long ll;
using namespace std;
ll i,n,m,x1,y1,x2,y2;

int main()
{
    ll ans = 0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> x1 >> y1 >> x2 >> y2;
		ans += (x2-x1+1)*(y2-y1+1);
	}
	cout << ans << endl;
	return 0;
}
