#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[10][10] = {0};
  int n, x1, x2, y1, y2;
  long count = 0;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    for (int i = x1 - 1; i < x2; i++)
      for (int j = y1 - 1; j < y2; j++) {
        arr[i][j] += 1;
        count += 1;
      }
  }
  cout << count << endl;
  return 0;
}
