#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n, x1, x2, y1, y2;
  scanf("%d", &n);
  int sum = 0;
  ;
  while (n--) {
    cin >> y1 >> x1 >> y2 >> x2;
    sum += (abs(x1 - x2) + 1) * (abs(y1 - y2) + 1);
  }
  printf("%d\n", sum);
  return 0;
}
