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