#include <stdio.h>int main()
{
int n,i,j;
int a[105]={0},b[105]={0},c[105]={0},d[105]={0};
int sum1=0,sum2=0;
int ands;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
sum1+=(c[i]-a[i])*(d[i]-b[i]);
for(j=i-1;j>=0;j--)
{
//if(!((a[j]>c[i])||(b[j]>d[i])||(a[i]>c[j])||(b[i]>d[j])))
//{
if(a[i]>a[j])
{
sum2+=(c[j]-a[i])*(d[j]-b[i]);
break;
}
else
{
sum2+=(c[i]-a[j])*(d[j]-b[i]);
break;
}
//}
}
}
ands=sum1-sum2;
printf("%d\n",ands);
return 0;
}
{
int n,i,j;
int a[105]={0},b[105]={0},c[105]={0},d[105]={0};
int sum1=0,sum2=0;
int ands;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]);
sum1+=(c[i]-a[i])*(d[i]-b[i]);
for(j=i-1;j>=0;j--)
{
//if(!((a[j]>c[i])||(b[j]>d[i])||(a[i]>c[j])||(b[i]>d[j])))
//{
if(a[i]>a[j])
{
sum2+=(c[j]-a[i])*(d[j]-b[i]);
break;
}
else
{
sum2+=(c[i]-a[j])*(d[j]-b[i]);
break;
}
//}
}
}
ands=sum1-sum2;
printf("%d\n",ands);
return 0;
}