#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e3 + 1, INF = 1e9 + 7;
long long n, a[MXN][MXN], x[MXN], y[MXN], x1[MXN], y2[MXN], cnt = 0;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i] >> x1[i] >> y2[i];
  }
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= n; k++) {
        if (x[k] <= j && j <= x1[k] && y[k] <= i && y2[k] >= i) {
          cnt++;
        }
      }
    }
  }
  cout << cnt;
  return 0;
}
