#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int x1, x2, y1, y2;
    cin >> x1 >> x2 >> y1 >> y2;
    sum += (max(x1, y1) - min(x1, y1) + 1) * (max(x2, y2) - min(x2, y2) + 1);
  }
  cout << sum << "\n";
  return 0;
}
