#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int n;
  cin >> n;
  while (n--) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int a, b, c, d;
    a = x1 > x2 ? x1 : x2;
    b = x1 > x2 ? x2 : x1;
    c = y1 > y2 ? y1 : y2;
    d = y1 > y2 ? y2 : y1;
    a = a - b + 1;
    c = c - d + 1;
    count += a * c;
  }
  cout << count;
  return 0;
}
