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