#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[105][105];
  int x, b, c, d, i, j;
  long long sum = 0;
  for (i = 0; i <= 100; i++) {
    for (j = 0; j <= 100; j++) a[i][j] = 0;
  }
  while (n--) {
    cin >> x >> b >> c >> d;
    for (i = x; i <= c; i++) {
      for (j = b; j <= d; j++) {
        a[i][j] = a[i][j] + 1;
      }
    }
  }
  for (i = 1; i <= 100; i++) {
    for (j = 1; j <= 100; j++) sum += a[i][j];
  }
  cout << sum << endl;
  return 0;
}
