#include <bits/stdc++.h>
using namespace std;
int mod(int a) {
  if (a < 0)
    return -1 * a;
  else
    return a;
}
int main() {
  int n;
  cin >> n;
  int xll, yll, xur, yur;
  int p, q;
  long long int sum = 0;
  while (n--) {
    cin >> xll;
    cin >> yll;
    cin >> xur;
    cin >> yur;
    p = mod(xll - xur) + 1;
    q = mod(yll - yur) + 1;
    sum = sum + p * q;
  }
  cout << sum;
  return 0;
}
