#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 2005;

vector<int> X,Y,X1,Y1,X2,Y2;
bool flag[MAX_N*2][MAX_N*2];
int n;

int main()
{
	int p,q,r,s;
	scanf("%d",&n);
	rep(i,n){
		scanf("%d%d%d%d",&p,&q,&r,&s);
		X.push_back(p),X.push_back(r);
		Y.push_back(q),Y.push_back(s);
		X1.push_back(p),X2.push_back(r);
		Y1.push_back(q),Y2.push_back(s);
	}
	sort(X.begin(),X.end());
	sort(Y.begin(),Y.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	rep(i,n){
		X1[i] = lower_bound(X.begin(),X.end(),X1[i]) - X.begin();
		Y1[i] = lower_bound(Y.begin(),Y.end(),Y1[i]) - Y.begin();
		X2[i] = lower_bound(X.begin(),X.end(),X2[i]) - X.begin();
		Y2[i] = lower_bound(Y.begin(),Y.end(),Y2[i]) - Y.begin();
	}
	rep(i,n){
		for(int j=Y1[i];j<Y2[i];j++){
			for(int k=X1[i];k<X2[i];k++){
				flag[j][k] = true;
			}
		}
	}
	ll ans = 0;
	rep(i,Y.size()-1){
		rep(j,X.size()-1){
			if(flag[i][j]){
				ans += (ll)(X[j+1]-X[j])*(Y[i+1]-Y[i]);
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}