#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[101][101];
  memset(a, 0, sizeof(a));
  int x1, y1, x2, y2;
  int xx1 = 1000, yy1 = 1000, xx2 = -1, yy2 = -1;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (x1 < xx1) xx1 = x1;
    if (y1 < yy1) yy1 = y1;
    if (x2 > xx2) xx2 = x2;
    if (y2 > yy2) yy2 = y2;
    for (int j = x1; j <= x2; j++)
      for (int i = y1; i <= y2; i++) a[j][i]++;
  }
  int m = 0;
  for (int j = xx1; j <= xx2; j++)
    for (int i = yy1; i <= yy2; i++) m += a[j][i];
  cout << m << endl;
}
