#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long testcases = 1;
  cin >> testcases;
  long long sum = 0;
  map<pair<long long, long long>, long long> m;
  while (testcases--) {
    long long x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for (long long i = x1; i <= x2; i++) {
      for (long long j = y1; j <= y2; j++) {
        m[{i, j}]++;
      }
    }
  }
  for (auto i : m) {
    sum += i.second;
  }
  cout << sum << endl;
  return 0;
}
