#include <bits/stdc++.h>
int main(void) {
  int num, x1, x2, y1, y2, max_c = 0, max_r = 0, col, row, sum = 0;
  int t[101][101] = {0};
  scanf("%d", &num);
  int i, j, k;
  for (i = 0; i < num; i++) {
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    col = x2 - x1;
    row = y2 - y1;
    if (max_c < x2) max_c = x2;
    if (max_r < y2) max_r = y2;
    for (j = x1; j <= x2; j++) {
      for (k = y1; k <= y2; k++) {
        t[j][k]++;
      }
    }
  }
  for (i = max_r; i >= 1; i--) {
    for (j = 1; j <= max_c; j++) {
      sum = sum + t[j][i];
    }
  }
  printf("%d\n", sum);
  return 0;
}
