#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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8ZGVxdWU+CiNpbmNsdWRlIDx0aW1lLmg+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxmc3RyZWFtPgojaW5jbHVkZSA8cXVldWU+CiNkZWZpbmUgbXAgbWFrZV9wYWlyCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgUEkgMy4xNDE1OTI2NTM1ODk3OTMyMzg0NgojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgSU5GICgobGwpMWUrMTUpCiNkZWZpbmUgeDEgZmxkZ2pkZmxnamhydGhybAojZGVmaW5lIHgyIGZsZGdqZGZsZ3J0eXJ0eWpsCiNkZWZpbmUgeTEgZmxkZ2dmaGZnaGpkZmxnamwKI2RlZmluZSB5MiBmZmdmbGRnamRmbGdqbAp0eX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