#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int n, r[N][4];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 4; ++j) {
      cin >> r[i][j];
    }
  }
  int sum = 0;
  for (int i = 1; i < N; ++i) {
    for (int j = 1; j < N; ++j) {
      for (int k = 0; k < n; ++k) {
        if (i >= r[k][0] && i <= r[k][2] && j >= r[k][1] && j <= r[k][3]) sum++;
      }
    }
  }
  cout << sum << endl;
}
