#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
vector<long long int> b;
int m[1000][1000];
int main() {
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      m[i][j] = 0;
    }
  }
  int n, x, y, x2, y2, c = 0;
  cin >> n;
  while (n--) {
    cin >> x >> y >> x2 >> y2;
    x--;
    y--;
    for (int i = x; i < x2; i++) {
      for (int j = y; j < y2; j++) {
        m[i][j]++;
        c++;
      }
    }
  }
  cout << c << endl;
  return 0;
}
