#include <bits/stdc++.h>
using namespace std;
int MIN(int a, int b) {
  int x = (b > a) ? a : b;
  return x;
}
int MAX(int a, int b) {
  int x = (b < a) ? a : b;
  return x;
}
const int size = 1000007;
const long long modulo = 1000000007;
const long long inf = 1e18;
const double eps = 1e-6;
long long n, t, a[4000], b[4000], k, n25, n50, n100;
int main() {
  while (cin >> n) {
    long long sum = 0;
    int x1, x2, y1, y2;
    for (int i = 0; i < n; i++) {
      cin >> x1 >> y1 >> x2 >> y2;
      sum += (x2 - x1 + 1) * (y2 - y1 + 1);
    }
    cout << sum << endl;
  }
  return 0;
}
