#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a[101][101] = {0}, d = 0;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    long long int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for (long long int j = x1; j <= x2; j++) {
      for (long long int k = y1; k <= y2; k++) {
        d++;
      }
    }
  }
  cout << d << endl;
}
