#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, a = 0, b = 0, c = 0, d = 0, sum = 0;
  int e[101][101];
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      e[i][j] = 0;
    }
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    for (int x = a - 1; x <= c - 1; x++) {
      for (int y = b - 1; y <= d - 1; y++) {
        e[x][y]++;
      }
    }
  }
  for (int i = 0; i < 100; i++) {
    for (int j = 0; j < 100; j++) {
      sum += e[i][j];
    }
  }
  cout << sum;
}
