#include <bits/stdc++.h>
using namespace std;
const long long MOD = 100000000;
const int N = 101;
int m[N][N];
vector<pair<pair<int, int>, pair<int, int> > > rectan;
void ok(int x, int y) {
  for (int i = 0; i < rectan.size(); i++) {
    int x1 = rectan[i].first.first, y1 = rectan[i].first.second,
        x2 = rectan[i].second.first, y2 = rectan[i].second.second;
    int con = 0;
    if (x >= x1 && x <= x2) con++;
    if (y >= y1 && y <= y2) con++;
    if (con == 2) m[x][y]++;
  }
}
int main() {
  int n, x1, y1, x2, y2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    rectan.push_back({{x1, y1}, {x2, y2}});
  }
  memset(m, 0, sizeof m);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      ok(i, j);
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) sum += m[i][j];
  cout << sum << endl;
  return 0;
}
