#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, nb = 0, x1, x2, y1, y2;
  int i, j, k;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    for (j = y1 - 1; j < y2; j++) {
      for (k = x1 - 1; k < x2; k++) nb++;
    }
  }
  cout << nb;
  return 0;
}
