#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v(100 * 100);
  while (n--) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    x1--;
    y1--;
    x2--;
    y2--;
    for (int y = y1; y <= y2; y++) {
      for (int x = x1; x <= x2; x++) {
        v[x + y * 100]++;
      }
    }
  }
  cout << accumulate(begin(v), end(v), 0) << endl;
  return 0;
}
