#include <bits/stdc++.h>
using namespace std;
void each_case(int t) {
  int tot = 0, n, x1, x2, y1, y2;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    tot += (abs(x2 - x1) + 1) * (1 + abs(y2 - y1));
  }
  cout << tot << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1, i;
  for (i = 1; i <= t; i++) each_case(i);
  return 0;
}
