#include <bits/stdc++.h>
using namespace std;
int ma3x[128][128];
int main() {
  int n;
  int i, j, k;
  long long sum = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for (j = x1; j <= x2; j++)
      for (k = y1; k <= y2; k++) ma3x[j][k]++;
  }
  for (i = 0; i < 128; i++) {
    for (j = 0; j < 128; j++) sum += ma3x[i][j];
  }
  cout << sum << endl;
  return 0;
}
