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