#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int g = 0;
  pair<int, int> A[1000], B[1000];
  for (int i = 1; i <= n; i++) {
    cin >> A[i].first >> A[i].second;
    cin >> B[i].first >> B[i].second;
    g += (((B[i].first - A[i].first) + 1) * ((B[i].second - A[i].second) + 1));
  }
  cout << g;
  return 0;
}
